From 502004d23046c8586d7e55d0a980157719257222 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Fri, 3 Feb 2017 10:56:57 -0200 Subject: [PATCH] Implementa post --- sapl/materia/views.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sapl/materia/views.py b/sapl/materia/views.py index aac383fd8..619c1dde2 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -107,8 +107,17 @@ class AdicionarVariasAutorias(PermissionRequiredForAppCrudMixin, FilterView): return context def post(self, request, *args, **kwargs): + marcados = request.POST.getlist('autor_id') + + for m in marcados: + Autoria.objects.create( + materia_id=self.kwargs['pk'], + autor_id=m + ) + return HttpResponseRedirect( - reverse('sapl.materia:autoria_list', kwargs={'pk': pk})) + reverse('sapl.materia:autoria_list', + kwargs={'pk': self.kwargs['pk']})) class CriarProtocoloMateriaView(CreateView):