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. 2
      templates/protocoloadm/proposicoes_incorporadas.html
  6. 2
      templates/protocoloadm/proposicoes_naoincorporadas.html
  7. 2
      templates/protocoloadm/proposicoes_naorecebidas.html

3
protocoloadm/urls.py

@ -4,6 +4,7 @@ from protocoloadm.views import (AnularProtocoloAdmView,
DocumentoAcessorioAdministrativoView, DocumentoAcessorioAdministrativoView,
PesquisarDocumentoAdministrativo, PesquisarDocumentoAdministrativo,
ProposicaoReceberView, ProposicaoReceberView,
ProposicaoView,
ProposicoesIncorporadasView, ProposicoesIncorporadasView,
ProposicoesNaoIncorporadasView, ProposicoesNaoIncorporadasView,
ProposicoesNaoRecebidasView, ProposicoesNaoRecebidasView,
@ -62,4 +63,6 @@ urlpatterns = [
url(r'^protocoloadm/proposicoes-incorporadas', url(r'^protocoloadm/proposicoes-incorporadas',
ProposicoesIncorporadasView.as_view(), ProposicoesIncorporadasView.as_view(),
name='proposicoes_incorporadas'), 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 import DetailView, ListView
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django.views.generic.edit import FormMixin 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 materia.models import Proposicao, TipoMateriaLegislativa
from sapl.crud import build_crud from sapl.crud import build_crud
from vanilla import GenericView from vanilla import GenericView
@ -540,6 +545,52 @@ class ProposicoesIncorporadasView(ListView):
data_recebimento__isnull=False, data_recebimento__isnull=False,
status='I') 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): # class PesquisaDocForm(forms.Form):

2
templates/materia/formulario_simplificado.html

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

2
templates/protocoloadm/proposicoes_incorporadas.html

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

2
templates/protocoloadm/proposicoes_naoincorporadas.html

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

2
templates/protocoloadm/proposicoes_naorecebidas.html

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

Loading…
Cancel
Save