|
|
@ -1,4 +1,5 @@ |
|
|
|
from datetime import date, datetime |
|
|
|
|
|
|
|
from django import forms |
|
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
|
from django.core.urlresolvers import reverse |
|
|
@ -96,19 +97,24 @@ protocolo_materia_crud = build_crud( |
|
|
|
# [('justificativa_anulacao', 12)]], |
|
|
|
# ]) |
|
|
|
|
|
|
|
|
|
|
|
def get_tipos_materia(): |
|
|
|
return [('', 'Selecione')] + [(t.id, t.sigla + ' - ' + t.descricao) |
|
|
|
return [('', 'Selecione')] \ |
|
|
|
+ [(t.id, t.sigla + ' - ' + t.descricao) |
|
|
|
for t in TipoMateriaLegislativa.objects.all()] |
|
|
|
|
|
|
|
|
|
|
|
def get_range_anos(): |
|
|
|
return [('', 'Selecione')] + [(year, year) |
|
|
|
for year in range(date.today().year, 1960, -1)] |
|
|
|
return [('', 'Selecione')] \ |
|
|
|
+ [(year, year) for year in range(date.today().year, 1960, -1)] |
|
|
|
|
|
|
|
|
|
|
|
def get_tipos_documento(): |
|
|
|
return [('', 'Selecione')] + [(t.id, t.sigla + ' - ' + t.descricao) |
|
|
|
return [('', 'Selecione')] \ |
|
|
|
+ [(t.id, t.sigla + ' - ' + t.descricao) |
|
|
|
for t in TipoDocumentoAdministrativo.objects.all()] |
|
|
|
|
|
|
|
|
|
|
|
class ProtocoloListView(ListView): |
|
|
|
template_name = 'protocoloadm/protocolo_list.html' |
|
|
|
context_object_name = 'protocolos' |
|
|
@ -139,9 +145,13 @@ class ProtocoloForm(forms.Form): |
|
|
|
attrs={'class': 'selector'})) |
|
|
|
|
|
|
|
inicial = forms.DateField(label='Data Inicial', |
|
|
|
required=False, widget=forms.TextInput(attrs={'class':'dateinput'})) |
|
|
|
required=False, |
|
|
|
widget=forms.TextInput( |
|
|
|
attrs={'class': 'dateinput'})) |
|
|
|
|
|
|
|
final = forms.DateField(label='Data Final', required=False, widget=forms.TextInput(attrs={'class':'dateinput'})) |
|
|
|
final = forms.DateField(label='Data Final', required=False, |
|
|
|
widget=forms.TextInput( |
|
|
|
attrs={'class': 'dateinput'})) |
|
|
|
|
|
|
|
natureza_processo = forms.CharField( |
|
|
|
label='Natureza Processo', required=False) |
|
|
@ -161,6 +171,7 @@ class ProtocoloForm(forms.Form): |
|
|
|
autor = forms.CharField(label='Autor', required=False) |
|
|
|
assunto = forms.CharField(label='Assunto', required=False) |
|
|
|
|
|
|
|
|
|
|
|
class ProtocoloPesquisaView(TemplateView, FormMixin): |
|
|
|
template_name = 'protocoloadm/protocolo_pesquisa.html' |
|
|
|
form_class = ProtocoloForm() |
|
|
@ -276,8 +287,6 @@ class AnularProtocoloAdmView(FormMixin, TemplateView): |
|
|
|
|
|
|
|
form = AnularProcoloAdmForm(request.POST) |
|
|
|
|
|
|
|
template_name = reverse("anular_protocolo") |
|
|
|
|
|
|
|
if form.is_valid(): |
|
|
|
|
|
|
|
numero = request.POST['numero_protocolo'] |
|
|
@ -303,10 +312,10 @@ class AnularProtocoloAdmView(FormMixin, TemplateView): |
|
|
|
protocolo.user_anulacao = user_anulacao |
|
|
|
protocolo.ip_anulacao = ip_addr |
|
|
|
protocolo.save() |
|
|
|
|
|
|
|
message = "Protocolo criado com sucesso" |
|
|
|
|
|
|
|
return render(request, self.template_name, {'form': form, 'message': message}) |
|
|
|
return render(request, |
|
|
|
reverse("anular_protocolo"), |
|
|
|
{'form': form, 'message': message}) |
|
|
|
|
|
|
|
except ObjectDoesNotExist: |
|
|
|
errors = form._errors.setdefault( |
|
|
|