Browse Source

Adiciona autores em Group model

Signed-off-by: Luciano Almeida <lucianoalmeida@interlegis.leg.br>
pull/1161/head
Luciano Almeida 8 years ago
parent
commit
a2fa3b62c4
  1. 8
      sapl/legacy/migration.py

8
sapl/legacy/migration.py

@ -8,6 +8,7 @@ import yaml
from django.apps import apps
from django.apps.config import AppConfig
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db import OperationalError, ProgrammingError, connections, models
@ -755,6 +756,13 @@ def adjust_autor(new, old):
with reversion.create_revision():
user.save()
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
else:
new.user = get_user_model().objects.filter(

Loading…
Cancel
Save