Browse Source

Fix #1095

pull/1126/head
Eduardo Calil 8 years ago
parent
commit
33a65dc116
  1. 1
      sapl/materia/models.py
  2. 12
      sapl/materia/views.py

1
sapl/materia/models.py

@ -259,7 +259,6 @@ class MateriaLegislativa(models.Model):
force_update=force_update, force_update=force_update,
using=using, using=using,
update_fields=update_fields) update_fields=update_fields)
@reversion.register() @reversion.register()

12
sapl/materia/views.py

@ -187,6 +187,18 @@ class CriarProtocoloMateriaView(CreateView):
def form_valid(self, form): def form_valid(self, form):
materia = form.save() 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)) return redirect(self.get_success_url(materia))

Loading…
Cancel
Save