Browse Source

Adjust pep8

pull/6/head
Marcio Mazza 10 years ago
parent
commit
a00b41b0b4
  1. 9
      comissoes/urls.py
  2. 3
      comissoes/views.py
  3. 9
      legacy/scripts/scrap_original_forms.py
  4. 7
      materia/forms.py
  5. 6
      protocoloadm/forms.py
  6. 10
      sessao/forms.py
  7. 11
      sessao/models.py
  8. 12
      sessao/urls.py
  9. 4
      sessao/views.py

9
comissoes/urls.py

@ -1,11 +1,14 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from comissoes.views import ComissaoListView, ComissaoDetailView, ComissaoUpdateView from comissoes.views import (
ComissaoListView, ComissaoDetailView, ComissaoUpdateView)
urlpatterns = patterns( urlpatterns = patterns(
'comissoes.views', 'comissoes.views',
url(r'^$', ComissaoListView.as_view(), name='comissao_list'), url(r'^$', ComissaoListView.as_view(), name='comissao_list'),
url(r'^(?P<pk>\d+)$', ComissaoDetailView.as_view(), name='comissao_detail'), url(r'^(?P<pk>\d+)$', ComissaoDetailView.as_view(),
url(r'^(?P<pk>\d+)/edit$', ComissaoUpdateView.as_view(), name='comissao_update'), name='comissao_detail'),
url(r'^(?P<pk>\d+)/edit$', ComissaoUpdateView.as_view(),
name='comissao_update'),
) )

3
comissoes/views.py

@ -1,6 +1,7 @@
from braces.views import FormMessagesMixin from braces.views import FormMessagesMixin
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.views.generic import CreateView, DeleteView, ListView, UpdateView, DetailView from django.views.generic import (
CreateView, DeleteView, ListView, UpdateView, DetailView)
from comissoes.models import Comissao from comissoes.models import Comissao
from .forms import ComissaoForm from .forms import ComissaoForm

9
legacy/scripts/scrap_original_forms.py

@ -228,9 +228,12 @@ def extract_fieldsets_for_current(model):
reverse_field_renames.update(adjustments) reverse_field_renames.update(adjustments)
for fieldset in fieldsets: for fieldset in fieldsets:
rows = [colsplit([reverse_field_renames.get(name, '%s_FIXME' % name) rows = [
for name, __ in line]) colsplit(
for line in fieldset['lines'] if line] [reverse_field_renames.get(name, '%s_FIXME' % name)
for name, __ in line])
for line in fieldset['lines'] if line
]
yield [fieldset['legend']] + rows yield [fieldset['legend']] + rows
except Exception as e: except Exception as e:
print_title_and_fieldsets(model) print_title_and_fieldsets(model)

7
materia/forms.py

@ -2,9 +2,10 @@ from crispy_forms.helper import FormHelper
from django import forms from django import forms
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from .models import (Origem, MateriaLegislativa, Anexada, TipoAutor, Autor, from .models import (
Autoria, DocumentoAcessorio, Numeracao, Orgao, Relatoria, Origem, MateriaLegislativa, Anexada, TipoAutor, Autor, Autoria,
TipoProposicao, Proposicao, StatusTramitacao, UnidadeTramitacao, Tramitacao, ) DocumentoAcessorio, Numeracao, Orgao, Relatoria, TipoProposicao,
Proposicao, StatusTramitacao, UnidadeTramitacao, Tramitacao)
from sapl.layout import SaplFormLayout from sapl.layout import SaplFormLayout

6
protocoloadm/forms.py

@ -65,7 +65,8 @@ class DocumentoAcessorioAdministrativoForm(forms.ModelForm):
exclude = [] exclude = []
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(DocumentoAcessorioAdministrativoForm, self).__init__(*args, **kwargs) super(DocumentoAcessorioAdministrativoForm, self).__init__(
*args, **kwargs)
self.helper = FormHelper() self.helper = FormHelper()
self.helper.layout = SaplFormLayout( self.helper.layout = SaplFormLayout(
@ -131,7 +132,8 @@ class StatusTramitacaoAdministrativoForm(forms.ModelForm):
exclude = [] exclude = []
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(StatusTramitacaoAdministrativoForm, self).__init__(*args, **kwargs) super(StatusTramitacaoAdministrativoForm, self).__init__(
*args, **kwargs)
self.helper = FormHelper() self.helper = FormHelper()
self.helper.layout = SaplFormLayout( self.helper.layout = SaplFormLayout(

10
sessao/forms.py

@ -43,12 +43,12 @@ class SessaoPlenariaForm(forms.ModelForm):
('sessao_legislativa', 3)], ('sessao_legislativa', 3)],
[('data_inicio', 12)], [('data_inicio', 12)],
[('data_fim', 12)], [('data_fim', 12)],
[('dia',2), [('dia', 2),
('hora_inicio',2), ('hora_inicio', 2),
('hora_fim',2), ('hora_fim', 2),
('tipo_expediente',6)], ('tipo_expediente', 6)],
[('url_audio', 6), ('url_video', 6)]], [('url_audio', 6), ('url_video', 6)]],
) )

11
sessao/models.py

@ -52,7 +52,8 @@ class SessaoPlenaria(models.Model):
verbose_name_plural = _('Sessões Plenárias') verbose_name_plural = _('Sessões Plenárias')
def __str__(self): def __str__(self):
return _('%(numero)sª Sessão %(tipo_nome)s da %(sessao_legislativa_numero)sª Sessão Legislativa' return _('%(numero)sª Sessão %(tipo_nome)s'
' da %(sessao_legislativa_numero)sª Sessão Legislativa'
' da %(legislatura_id)sª Legislatura') % { ' da %(legislatura_id)sª Legislatura') % {
'numero': self.numero, 'numero': self.numero,
@ -212,9 +213,11 @@ class RegistroVotacao(models.Model):
verbose_name_plural = _('Votações') verbose_name_plural = _('Votações')
def __str__(self): def __str__(self):
return _('Ordem: %(ordem)s - Votação: %(votacao)s - Matéria: %(materia)s') % { return _('Ordem: %(ordem)s - Votação: %(votacao)s - '
'ordem': self.ordem, 'votacao': self.tipo_resultado_votacao, 'materia': self.materia} 'Matéria: %(materia)s') % {
'ordem': self.ordem,
'votacao': self.tipo_resultado_votacao,
'materia': self.materia}
class VotoParlamentar(models.Model): # RegistroVotacaoParlamentar class VotoParlamentar(models.Model): # RegistroVotacaoParlamentar

12
sessao/urls.py

@ -1,12 +1,16 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from sessao.views import SessaoPlenariaListView, SessaoPlenariaDetailView, SessaoPlenariaCreateView, SessaoPlenariaUpdateView from sessao.views import (SessaoPlenariaListView, SessaoPlenariaDetailView,
SessaoPlenariaCreateView, SessaoPlenariaUpdateView)
urlpatterns = patterns( urlpatterns = patterns(
'sessao.views', 'sessao.views',
url(r'^$', SessaoPlenariaListView.as_view(), name='sessao_list'), url(r'^$', SessaoPlenariaListView.as_view(), name='sessao_list'),
url(r'^(?P<pk>\d+)$', SessaoPlenariaDetailView.as_view(), name='sessao_detail'), url(r'^(?P<pk>\d+)$', SessaoPlenariaDetailView.as_view(),
url(r'^create$', SessaoPlenariaCreateView.as_view(), name='sessao_create'), name='sessao_detail'),
url(r'^(?P<pk>\d+)/edit$', SessaoPlenariaUpdateView.as_view(), name='sessao_update'), url(r'^create$', SessaoPlenariaCreateView.as_view(),
name='sessao_create'),
url(r'^(?P<pk>\d+)/edit$', SessaoPlenariaUpdateView.as_view(),
name='sessao_update'),
) )

4
sessao/views.py

@ -1,10 +1,12 @@
from braces.views import FormMessagesMixin from braces.views import FormMessagesMixin
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.views.generic import CreateView, DeleteView, ListView, UpdateView, DetailView from django.views.generic import (
CreateView, DeleteView, ListView, UpdateView, DetailView)
from sessao.models import SessaoPlenaria from sessao.models import SessaoPlenaria
from .forms import SessaoPlenariaForm from .forms import SessaoPlenariaForm
class SessaoPlenariaListView(ListView): class SessaoPlenariaListView(ListView):
model = SessaoPlenaria model = SessaoPlenaria

Loading…
Cancel
Save