diff --git a/sapl/materia/models.py b/sapl/materia/models.py index d5447095e..2db7c38d8 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -259,7 +259,6 @@ class MateriaLegislativa(models.Model): force_update=force_update, using=using, update_fields=update_fields) - @reversion.register() diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 2cb4d54f6..fa3e66970 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -187,6 +187,18 @@ class CriarProtocoloMateriaView(CreateView): def form_valid(self, form): materia = form.save() + + try: + protocolo = Protocolo.objects.get(pk=self.kwargs['pk']) + except ObjectDoesNotExist: + raise Http404() + + if protocolo.autor: + Autoria.objects.create( + materia=materia, + autor=protocolo.autor, + primeiro_autor=True) + return redirect(self.get_success_url(materia))