Browse Source

Fix qa_check alerts

pull/98/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
parent
commit
e292cb51c2
  1. 19
      base/models.py
  2. 4
      base/urls.py
  3. 22
      base/views.py
  4. 5
      comissoes/urls.py
  5. 76
      comissoes/views.py
  6. 3
      materia/views.py
  7. 4
      sapl/context_processors.py
  8. 2
      sapl/settings.py
  9. 5
      sessao/urls.py

19
base/models.py

@ -1,6 +1,7 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
def get_sessao_media_path(instance, subpath, filename):
return './casa/%s/%s/%s' % (instance.codigo, subpath, filename)
@ -8,6 +9,7 @@ def get_sessao_media_path(instance, subpath, filename):
def get_casa_media_path(instance, filename):
return get_sessao_media_path(instance, 'Logotipo', filename)
class CasaLegislativa(models.Model):
# TODO ajustar todos os max_length !!!!
# cod_casa => id (pk)
@ -19,17 +21,24 @@ class CasaLegislativa(models.Model):
cep = models.CharField(max_length=100, verbose_name=_('CEP'))
municipio = models.CharField(max_length=100, verbose_name=_('Município'))
uf = models.CharField(max_length=100, verbose_name=_('UF'))
telefone = models.CharField(max_length=100, blank=True, null=True, verbose_name=_('Telefone'))
fax = models.CharField(max_length=100, blank=True, null=True, verbose_name=_('Fax'))
telefone = models.CharField(
max_length=100, blank=True, null=True, verbose_name=_('Telefone'))
fax = models.CharField(
max_length=100, blank=True, null=True, verbose_name=_('Fax'))
logotipo = models.ImageField(
blank=True,
null=True,
upload_to=get_casa_media_path,
verbose_name=_('Logotipo'))
endereco_web = models.CharField(max_length=100, blank=True, null=True, verbose_name=_('HomePage'))
email = models.CharField(max_length=100, blank=True, null=True, verbose_name=_('E-mail'))
endereco_web = models.CharField(
max_length=100, blank=True, null=True, verbose_name=_('HomePage'))
email = models.CharField(
max_length=100, blank=True, null=True, verbose_name=_('E-mail'))
informacao_geral = models.CharField(
max_length=100, blank=True, null=True, verbose_name=_('Informação Geral'))
max_length=100,
blank=True,
null=True,
verbose_name=_('Informação Geral'))
class Meta:
verbose_name = _('Casa Legislativa')

4
base/urls.py

@ -1,8 +1,7 @@
from django.conf.urls import url
from django.views.generic.base import TemplateView
from .views import HelpView, CasaLegislativaTableAuxView
from .views import CasaLegislativaTableAuxView, HelpView
urlpatterns = [
url(r'^sistema/', TemplateView.as_view(template_name='sistema.html')),
@ -11,5 +10,4 @@ urlpatterns = [
name='help_base'),
url(r'^casa-legislativa$',
CasaLegislativaTableAuxView.as_view(), name='casa_legislativa'),
]

22
base/views.py

@ -1,6 +1,5 @@
import sapl
from crispy_forms.helper import FormHelper
from crispy_forms.layout import ButtonHolder, HTML, Fieldset, Layout, Submit
from crispy_forms.layout import HTML, ButtonHolder, Fieldset, Layout, Submit
from django import forms
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
@ -9,9 +8,9 @@ from django.views.generic.base import TemplateView
from django.views.generic.edit import FormMixin
from vanilla import GenericView
from .models import CasaLegislativa
import sapl
from sapl import settings
from .models import CasaLegislativa
class HelpView(TemplateView):
@ -60,9 +59,8 @@ class CasaLegislativaTabelaAuxForm(ModelForm):
widget=forms.Select(
attrs={'class': 'selector'}))
informacao_geral = forms.CharField(widget=forms.Textarea,
label='Informação Geral',
informacao_geral = forms.CharField(widget=forms.Textarea,
label='Informação Geral',
required=False)
telefone = forms.CharField(label='Telefone',
@ -78,7 +76,7 @@ class CasaLegislativaTabelaAuxForm(ModelForm):
fax = forms.CharField(label='Fax',
required=False,
widget=forms.TextInput(
attrs={'class': 'telefone'}))
attrs={'class': 'telefone'}))
class Meta:
@ -138,7 +136,7 @@ class CasaLegislativaTabelaAuxForm(ModelForm):
row4,
row5,
HTML("""{% if form.logotipo.value %}
<img class="img-responsive"
<img class="img-responsive"
src="{{ MEDIA_URL }}{{ form.logotipo.value }}">
{% endif %}""", ),
row6,
@ -177,11 +175,13 @@ class CasaLegislativaTableAuxView(FormMixin, GenericView):
casa_save = form.save(commit=False)
else:
casa_save = CasaLegislativaTabelaAuxForm(
request.POST, request.FILES, instance=casa).save(commit=False)
request.POST,
request.FILES,
instance=casa).save(commit=False)
casa_save.save()
return self.form_valid(form)
else:
return self.render_to_response({'form': form})
def get_success_url(self):
return reverse('casa_legislativa')
return reverse('casa_legislativa')

5
comissoes/urls.py

@ -1,10 +1,11 @@
from django.conf.urls import include, url
from comissoes.views import (ComissaoParlamentarEditView,
from comissoes.views import (CadastrarComissaoView,
ComissaoParlamentarEditView,
ComissaoParlamentarIncluirView, ComposicaoView,
MateriasView, ReunioesView, cargo_crud,
comissao_crud, periodo_composicao_crud,
tipo_comissao_crud,CadastrarComissaoView)
tipo_comissao_crud)
comissao_url_patterns = comissao_crud.urlpatterns + [
url(r'^(?P<pk>\d+)/composicao$',

76
comissoes/views.py

@ -1,5 +1,5 @@
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit, MultiField, Div, Field
from crispy_forms.layout import ButtonHolder, Fieldset, Layout, Submit
from django import forms
from django.core.urlresolvers import reverse
from django.forms import ModelForm
@ -7,7 +7,6 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import FormMixin
from vanilla import GenericView
import sapl
from parlamentares.models import Filiacao, Parlamentar
from sapl.crud import build_crud
@ -66,7 +65,6 @@ comissao_crud = build_crud(
class CadastrarComissaoForm(ModelForm):
class Meta:
@ -103,61 +101,60 @@ class CadastrarComissaoForm(ModelForm):
row2 = sapl.layout.to_row(
[('tipo', 3),
('data_criacao', 3),
('unidade_deliberativa',3),
('data_extincao',3)])
('unidade_deliberativa', 3),
('data_extincao', 3)])
row3 = sapl.layout.to_row(
[('local_reuniao',4),
('agenda_reuniao',4),
('telefone_reuniao',4)])
[('local_reuniao', 4),
('agenda_reuniao', 4),
('telefone_reuniao', 4)])
row4 = sapl.layout.to_row(
[('endereco_secretaria', 4),
('telefone_secretaria', 4),
('fax_secretaria', 4)])
('telefone_secretaria', 4),
('fax_secretaria', 4)])
row5 = sapl.layout.to_row(
[('secretario',6),
('email',6)])
[('secretario', 6),
('email', 6)])
row6 = sapl.layout.to_row(
[('finalidade', 12)])
row7 = sapl.layout.to_row(
[('apelido_temp', 9),
('data_instalacao_temp',3)])
('data_instalacao_temp', 3)])
row8 = sapl.layout.to_row(
[('data_final_prevista_temp',4),
('data_prorrogada_temp',4),
('data_fim_comissao',4)])
[('data_final_prevista_temp', 4),
('data_prorrogada_temp', 4),
('data_fim_comissao', 4)])
self.helper = FormHelper()
self.helper.layout = Layout(
Fieldset(
'Cadastrar Comissão',
Fieldset(
'Dados Básicos',
row1,
row2
),
Fieldset(
'Dados Complementares',
row3,
row4,
row5,
row6
),
Fieldset(
'Temporária',
row7,
row8
),
ButtonHolder(
Submit('submit', 'Salvar',
css_class='button primary')
)
'Cadastrar Comissão',
Fieldset(
'Dados Básicos',
row1,
row2
),
Fieldset(
'Dados Complementares',
row3,
row4,
row5,
row6
),
Fieldset(
'Temporária',
row7,
row8
),
ButtonHolder(
Submit('submit', 'Salvar',
css_class='button primary')
)
)
)
super(CadastrarComissaoForm, self).__init__(*args, **kwargs)
@ -187,7 +184,6 @@ class CadastrarComissaoView(FormMixin, GenericView):
return reverse('comissao:list')
class ComposicaoForm(forms.Form):
periodo = forms.CharField()

3
materia/views.py

@ -2,8 +2,7 @@ from datetime import date, datetime
from re import sub
from crispy_forms.helper import FormHelper
from crispy_forms.layout import (HTML, ButtonHolder, Column, Fieldset, Layout,
Submit)
from crispy_forms.layout import ButtonHolder, Column, Fieldset, Layout, Submit
from django import forms
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse

4
sapl/context_processors.py

@ -3,7 +3,7 @@ from base.models import CasaLegislativa
# TODO: this need to be cached and retrieved once!!!
def query_database():
def query_database():
return CasaLegislativa.objects.first()
@ -29,4 +29,4 @@ def parliament_info(request):
context['state'] = casa_legislativa.uf
context['logotipo'] = casa_legislativa.logotipo
return context;
return context

2
sapl/settings.py

@ -87,7 +87,7 @@ TEMPLATES = [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.static",
'django.contrib.messages.context_processors.messages',
'sapl.context_processors.parliament_info',
],

5
sessao/urls.py

@ -1,5 +1,6 @@
from django.conf.urls import include, url
from sapl import settings
from sessao.views import (EditExpedienteOrdemDiaView, EditMateriaOrdemDiaView,
ExpedienteOrdemDiaView, ExpedienteView,
ExplicacaoDelete, ExplicacaoEdit, ExplicacaoView,
@ -17,8 +18,6 @@ from sessao.views import (EditExpedienteOrdemDiaView, EditMateriaOrdemDiaView,
VotacaoView, sessao_crud, tipo_expediente_crud,
tipo_resultado_votacao_crud, tipo_sessao_crud)
from sapl import settings
urlpatterns_sessao = sessao_crud.urlpatterns + [
url(r'^(?P<pk>\d+)/expediente$',
ExpedienteView.as_view(), name='expediente'),
@ -98,7 +97,7 @@ urlpatterns = [
sessao_crud.namespace, sessao_crud.namespace)),
url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
url(r'^sistema/sessao-plenaria/tipo/', include(tipo_sessao_crud.urls)),
url(r'^sistema/sessao-plenaria/tipo/', include(tipo_sessao_crud.urls)),
url(r'^sistema/sessao-plenaria/tipo-resultado-votacao/',
include(tipo_resultado_votacao_crud.urls)),
url(r'^sistema/sessao-plenaria/tipo-expediente/',

Loading…
Cancel
Save