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. 12
      base/views.py
  4. 5
      comissoes/urls.py
  5. 28
      comissoes/views.py
  6. 3
      materia/views.py
  7. 2
      sapl/context_processors.py
  8. 3
      sessao/urls.py

19
base/models.py

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

4
base/urls.py

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

12
base/views.py

@ -1,6 +1,5 @@
import sapl
from crispy_forms.helper import FormHelper 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 import forms
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse 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 django.views.generic.edit import FormMixin
from vanilla import GenericView from vanilla import GenericView
from .models import CasaLegislativa import sapl
from sapl import settings from .models import CasaLegislativa
class HelpView(TemplateView): class HelpView(TemplateView):
@ -60,7 +59,6 @@ class CasaLegislativaTabelaAuxForm(ModelForm):
widget=forms.Select( widget=forms.Select(
attrs={'class': 'selector'})) attrs={'class': 'selector'}))
informacao_geral = forms.CharField(widget=forms.Textarea, informacao_geral = forms.CharField(widget=forms.Textarea,
label='Informação Geral', label='Informação Geral',
required=False) required=False)
@ -177,7 +175,9 @@ class CasaLegislativaTableAuxView(FormMixin, GenericView):
casa_save = form.save(commit=False) casa_save = form.save(commit=False)
else: else:
casa_save = CasaLegislativaTabelaAuxForm( casa_save = CasaLegislativaTabelaAuxForm(
request.POST, request.FILES, instance=casa).save(commit=False) request.POST,
request.FILES,
instance=casa).save(commit=False)
casa_save.save() casa_save.save()
return self.form_valid(form) return self.form_valid(form)
else: else:

5
comissoes/urls.py

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

28
comissoes/views.py

@ -1,5 +1,5 @@
from crispy_forms.helper import FormHelper 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 import forms
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.forms import ModelForm 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 django.views.generic.edit import FormMixin
from vanilla import GenericView from vanilla import GenericView
import sapl import sapl
from parlamentares.models import Filiacao, Parlamentar from parlamentares.models import Filiacao, Parlamentar
from sapl.crud import build_crud from sapl.crud import build_crud
@ -67,7 +66,6 @@ comissao_crud = build_crud(
class CadastrarComissaoForm(ModelForm): class CadastrarComissaoForm(ModelForm):
class Meta: class Meta:
model = Comissao model = Comissao
@ -103,14 +101,13 @@ class CadastrarComissaoForm(ModelForm):
row2 = sapl.layout.to_row( row2 = sapl.layout.to_row(
[('tipo', 3), [('tipo', 3),
('data_criacao', 3), ('data_criacao', 3),
('unidade_deliberativa',3), ('unidade_deliberativa', 3),
('data_extincao',3)]) ('data_extincao', 3)])
row3 = sapl.layout.to_row( row3 = sapl.layout.to_row(
[('local_reuniao',4), [('local_reuniao', 4),
('agenda_reuniao',4), ('agenda_reuniao', 4),
('telefone_reuniao',4)]) ('telefone_reuniao', 4)])
row4 = sapl.layout.to_row( row4 = sapl.layout.to_row(
[('endereco_secretaria', 4), [('endereco_secretaria', 4),
@ -118,20 +115,20 @@ class CadastrarComissaoForm(ModelForm):
('fax_secretaria', 4)]) ('fax_secretaria', 4)])
row5 = sapl.layout.to_row( row5 = sapl.layout.to_row(
[('secretario',6), [('secretario', 6),
('email',6)]) ('email', 6)])
row6 = sapl.layout.to_row( row6 = sapl.layout.to_row(
[('finalidade', 12)]) [('finalidade', 12)])
row7 = sapl.layout.to_row( row7 = sapl.layout.to_row(
[('apelido_temp', 9), [('apelido_temp', 9),
('data_instalacao_temp',3)]) ('data_instalacao_temp', 3)])
row8 = sapl.layout.to_row( row8 = sapl.layout.to_row(
[('data_final_prevista_temp',4), [('data_final_prevista_temp', 4),
('data_prorrogada_temp',4), ('data_prorrogada_temp', 4),
('data_fim_comissao',4)]) ('data_fim_comissao', 4)])
self.helper = FormHelper() self.helper = FormHelper()
self.helper.layout = Layout( self.helper.layout = Layout(
@ -187,7 +184,6 @@ class CadastrarComissaoView(FormMixin, GenericView):
return reverse('comissao:list') return reverse('comissao:list')
class ComposicaoForm(forms.Form): class ComposicaoForm(forms.Form):
periodo = forms.CharField() periodo = forms.CharField()

3
materia/views.py

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

2
sapl/context_processors.py

@ -29,4 +29,4 @@ def parliament_info(request):
context['state'] = casa_legislativa.uf context['state'] = casa_legislativa.uf
context['logotipo'] = casa_legislativa.logotipo context['logotipo'] = casa_legislativa.logotipo
return context; return context

3
sessao/urls.py

@ -1,5 +1,6 @@
from django.conf.urls import include, url from django.conf.urls import include, url
from sapl import settings
from sessao.views import (EditExpedienteOrdemDiaView, EditMateriaOrdemDiaView, from sessao.views import (EditExpedienteOrdemDiaView, EditMateriaOrdemDiaView,
ExpedienteOrdemDiaView, ExpedienteView, ExpedienteOrdemDiaView, ExpedienteView,
ExplicacaoDelete, ExplicacaoEdit, ExplicacaoView, ExplicacaoDelete, ExplicacaoEdit, ExplicacaoView,
@ -17,8 +18,6 @@ from sessao.views import (EditExpedienteOrdemDiaView, EditMateriaOrdemDiaView,
VotacaoView, sessao_crud, tipo_expediente_crud, VotacaoView, sessao_crud, tipo_expediente_crud,
tipo_resultado_votacao_crud, tipo_sessao_crud) tipo_resultado_votacao_crud, tipo_sessao_crud)
from sapl import settings
urlpatterns_sessao = sessao_crud.urlpatterns + [ urlpatterns_sessao = sessao_crud.urlpatterns + [
url(r'^(?P<pk>\d+)/expediente$', url(r'^(?P<pk>\d+)/expediente$',
ExpedienteView.as_view(), name='expediente'), ExpedienteView.as_view(), name='expediente'),

Loading…
Cancel
Save