Browse Source

Cria TemplateView após procolação

pull/778/head
Eduardo Edson Batista Cordeiro Alves 8 years ago
parent
commit
334be302de
  1. 3
      sapl/protocoloadm/urls.py
  2. 20
      sapl/protocoloadm/views.py
  3. 14
      sapl/templates/protocoloadm/MateriaTemplate.html

3
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<pk>\d+)/continuar$',
ProtocoloMateriaTemplateView.as_view(), name='materia_continuar'),
url(r'^protocoloadm/anular-protocolo',

20
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,

14
sapl/templates/protocoloadm/MateriaTemplate.html

@ -0,0 +1,14 @@
{% extends "base.html" %}
{% load i18n common_tags%}
{% block base_content %}
<b>Matéria procololada com sucesso!</b>
<br />
<a href="{% url 'sapl.protocoloadm:protocolo_mostrar' protocolo.pk%}">Imprimir Etiqueta</a>
<a target="popup" onclick="window.open('{% url 'sapl.protocoloadm:comprovante_protocolo' protocolo.pk%}','Comprovante','width=800, height=600')">Comprovante
</a>
<br />
<a href="" class="btn btn-primary">Criar Matéria</a>
<br />
<a href="{% url 'sapl.protocoloadm:protocolo_mostrar' protocolo.pk%}">Continuar</a>
{% endblock base_content %}
Loading…
Cancel
Save