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

@ -261,7 +261,6 @@ class MateriaLegislativa(models.Model):
update_fields=update_fields)
@reversion.register()
class Autoria(models.Model):
autor = models.ForeignKey(Autor,

12
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))

Loading…
Cancel
Save