Browse Source

Add new view to Proposicões

pull/11/merge
Edward Ribeiro 9 years ago
parent
commit
bca9d5ded7
  1. 3
      protocoloadm/urls.py
  2. 51
      protocoloadm/views.py
  3. 2
      templates/materia/formulario_simplificado.html
  4. 7
      templates/protocoloadm/proposicao_view.html
  5. 4
      templates/protocoloadm/proposicoes_incorporadas.html
  6. 4
      templates/protocoloadm/proposicoes_naoincorporadas.html
  7. 6
      templates/protocoloadm/proposicoes_naorecebidas.html

3
protocoloadm/urls.py

@ -4,6 +4,7 @@ from protocoloadm.views import (AnularProtocoloAdmView,
DocumentoAcessorioAdministrativoView,
PesquisarDocumentoAdministrativo,
ProposicaoReceberView,
ProposicaoView,
ProposicoesIncorporadasView,
ProposicoesNaoIncorporadasView,
ProposicoesNaoRecebidasView,
@ -62,4 +63,6 @@ urlpatterns = [
url(r'^protocoloadm/proposicoes-incorporadas',
ProposicoesIncorporadasView.as_view(),
name='proposicoes_incorporadas'),
url(r'^protocoloadm/(?P<pk>\d+)/proposicao',
ProposicaoView.as_view(), name='proposicao_view')
]

51
protocoloadm/views.py

@ -16,6 +16,11 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic import DetailView, ListView
from django.views.generic.base import TemplateView
from django.views.generic.edit import FormMixin
from django.views.generic import FormView
from django.views.generic import DetailView
from vanilla import GenericView
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Field
from materia.models import Proposicao, TipoMateriaLegislativa
from sapl.crud import build_crud
from vanilla import GenericView
@ -540,6 +545,52 @@ class ProposicoesIncorporadasView(ListView):
data_recebimento__isnull=False,
status='I')
class ProposicaoSimpleForm(forms.Form):
tipo = forms.CharField(label='Tipo',
widget = forms.TextInput(
attrs={'readonly':'readonly'}))
materia = forms.CharField(label='Matéria',
widget = forms.TextInput(
attrs={'readonly':'readonly'}))
data_envio = forms.DateField(label='Data Envio',
widget=forms.DateInput(format = '%d/%m/%Y', attrs={'readonly':'readonly'}))
data_recebimento = forms.DateField(label='Data Recebimento',
widget=forms.DateInput(format = '%d/%m/%Y', attrs={'readonly':'readonly'}))
descricao = forms.CharField(label='Descrição',
widget = forms.TextInput(
attrs={'readonly':'readonly'}))
numero_proposicao = forms.CharField(label='Número',
widget = forms.TextInput(
attrs={'readonly':'readonly'}))
# ano = forms.CharField(label='Ano',
# widget = forms.TextInput(
# attrs={'readonly':'readonly'}))
class ProposicaoView(DetailView):
template_name = "protocoloadm/proposicao_view.html"
model = Proposicao
def get(self, request, *args, **kwargs):
proposicao = Proposicao.objects.get(id=kwargs['pk'])
data = {# 'ano': proposicao.ano, # TODO: FIX
'tipo': proposicao.tipo.descricao, #TODO: FIX
'materia': proposicao.materia,
'numero_proposicao': proposicao.numero_proposicao,
'data_envio': proposicao.data_envio,
'data_recebimento': proposicao.data_recebimento,
'descricao': proposicao.descricao}
form = ProposicaoSimpleForm(initial=data)
return self.render_to_response({'form': form})
def get_context_data(self, **kwargs):
context = super(ProposicaoView, self).get_context_data(**kwargs)
context['form'] = ProposicaoSimpleForm
return context
# class PesquisaDocForm(forms.Form):

2
templates/materia/formulario_simplificado.html

@ -5,7 +5,7 @@
{% block detail_content %}
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
{% crispy form %}
</br>
<input type="submit" name="salvar_simplificado" value="Salvar" class="button primary" />
</form>

7
templates/protocoloadm/proposicao_view.html

@ -0,0 +1,7 @@
{% extends "protocoloadm/protocoloadm_detail.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block detail_content %}
{{ form.as_p }}
{% endblock detail_content %}

4
templates/protocoloadm/proposicoes_incorporadas.html

@ -8,7 +8,9 @@
{% for p in object_list %}
<tr>
<td>
{{ p.data_envio|date:"d/m/Y" }}
<a href="{% url 'proposicao_view' p.id %}">
{{ p.data_envio|date:"d/m/Y" }}
</a>
</td>
<!-- <td>
{{ p.tipo.descricao }}

4
templates/protocoloadm/proposicoes_naoincorporadas.html

@ -8,7 +8,9 @@
{% for p in object_list %}
<tr>
<td>
{{ p.data_envio|date:"d/m/Y" }}
<a href="{% url 'proposicao_view' p.id %}">
{{ p.data_envio|date:"d/m/Y" }}
</a>
</td>
<!-- <td>
{{ p.tipo.descricao }}

6
templates/protocoloadm/proposicoes_naorecebidas.html

@ -7,8 +7,10 @@
<table>
{% for p in object_list %}
<tr>
<td>
{{ p.data_envio|date:"d/m/Y" }}
<td>
<a href="{% url 'proposicao_view' p.id %}">
{{ p.data_envio|date:"d/m/Y" }}
</a>
</td>
<!-- <td>
{{ p.tipo.descricao }}

Loading…
Cancel
Save