|
@ -8,6 +8,7 @@ import yaml |
|
|
from django.apps import apps |
|
|
from django.apps import apps |
|
|
from django.apps.config import AppConfig |
|
|
from django.apps.config import AppConfig |
|
|
from django.contrib.auth import get_user_model |
|
|
from django.contrib.auth import get_user_model |
|
|
|
|
|
from django.contrib.auth.models import Group |
|
|
from django.contrib.contenttypes.models import ContentType |
|
|
from django.contrib.contenttypes.models import ContentType |
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
from django.db import OperationalError, ProgrammingError, connections, models |
|
|
from django.db import OperationalError, ProgrammingError, connections, models |
|
@ -755,6 +756,13 @@ def adjust_autor(new, old): |
|
|
with reversion.create_revision(): |
|
|
with reversion.create_revision(): |
|
|
user.save() |
|
|
user.save() |
|
|
reversion.set_comment('Objeto criado pela migração') |
|
|
reversion.set_comment('Objeto criado pela migração') |
|
|
|
|
|
|
|
|
|
|
|
grupo_autor = Group.objects.get(name="Autor") |
|
|
|
|
|
user.groups.add(grupo_autor) |
|
|
|
|
|
if old.cod_parlamentar: |
|
|
|
|
|
grupo_parlamentar = Group.objects.get(name="Parlamentar") |
|
|
|
|
|
user.groups.add(grupo_parlamentar) |
|
|
|
|
|
|
|
|
new.user = user |
|
|
new.user = user |
|
|
else: |
|
|
else: |
|
|
new.user = get_user_model().objects.filter( |
|
|
new.user = get_user_model().objects.filter( |
|
|