From 334be302de286cfb0fd68981893cf8d069b2b2e5 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Thu, 3 Nov 2016 14:40:28 -0200 Subject: [PATCH] =?UTF-8?q?Cria=20TemplateView=20ap=C3=B3s=20procola=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/protocoloadm/urls.py | 3 +++ sapl/protocoloadm/views.py | 20 ++++++++++++++++--- .../protocoloadm/MateriaTemplate.html | 14 +++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 sapl/templates/protocoloadm/MateriaTemplate.html diff --git a/sapl/protocoloadm/urls.py b/sapl/protocoloadm/urls.py index 1de09a01a..21c627b06 100644 --- a/sapl/protocoloadm/urls.py +++ b/sapl/protocoloadm/urls.py @@ -10,6 +10,7 @@ from sapl.protocoloadm.views import (AnularProtocoloAdmView, DocumentoAdministrativoCrud, PesquisarDocumentoAdministrativoView, ProtocoloDocumentoView, + ProtocoloMateriaTemplateView, ProtocoloMateriaView, ProtocoloMostrarView, ProtocoloPesquisaView, @@ -60,6 +61,8 @@ urlpatterns_protocolo = [ + url(r'^protocoloadm/(?P\d+)/continuar$', + ProtocoloMateriaTemplateView.as_view(), name='materia_continuar'), url(r'^protocoloadm/anular-protocolo', diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index 5019d47bf..dd478b93a 100644 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -312,8 +312,9 @@ class ProtocoloMateriaView(PermissionRequiredMixin, CreateView): form_valid_message = _('Matéria cadastrada com sucesso!') permission_required = ('protocoloadm.add_protocolo',) - def get_success_url(self): - return reverse('sapl.protocoloadm:protocolo') + def get_success_url(self, protocolo): + return reverse('sapl.protocoloadm:materia_continuar', kwargs={ + 'pk': protocolo.pk}) def form_valid(self, form): try: @@ -351,7 +352,20 @@ class ProtocoloMateriaView(PermissionRequiredMixin, CreateView): protocolo.numero_paginas = self.request.POST['numero_paginas'] protocolo.observacao = self.request.POST['observacao'] protocolo.save() - return redirect(self.get_success_url()) + return redirect(self.get_success_url(protocolo)) + + +class ProtocoloMateriaTemplateView(PermissionRequiredMixin, TemplateView): + + template_name = "protocoloadm/MateriaTemplate.html" + permission_required = ('protocoloadm.detail_protocolo', ) + + def get_context_data(self, **kwargs): + context = super(ProtocoloMateriaTemplateView, self).get_context_data( + **kwargs) + protocolo = Protocolo.objects.get(pk=self.kwargs['pk']) + context.update({'protocolo': protocolo}) + return context class PesquisarDocumentoAdministrativoView(DocumentoAdministrativoMixin, diff --git a/sapl/templates/protocoloadm/MateriaTemplate.html b/sapl/templates/protocoloadm/MateriaTemplate.html new file mode 100644 index 000000000..0af0ddbf9 --- /dev/null +++ b/sapl/templates/protocoloadm/MateriaTemplate.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} +{% load i18n common_tags%} + +{% block base_content %} +Matéria procololada com sucesso! +
+Imprimir Etiqueta +Comprovante + +
+Criar Matéria +
+Continuar +{% endblock base_content %}