From 65644623bd357cc2e9157ed4234725ca17987c48 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Fri, 11 Mar 2016 15:52:46 -0300 Subject: [PATCH 01/17] Retira namespaces das urls do crud --- comissoes/urls.py | 6 ++---- crud/base.py | 28 ++++++++++++---------------- crud/tests/test_base.py | 10 +++++----- materia/urls.py | 5 +---- norma/urls.py | 6 ++---- sessao/urls.py | 6 ++---- 6 files changed, 24 insertions(+), 37 deletions(-) diff --git a/comissoes/urls.py b/comissoes/urls.py index dfbde7d40..bff625ee0 100644 --- a/comissoes/urls.py +++ b/comissoes/urls.py @@ -7,9 +7,7 @@ from comissoes.views import (CadastrarComissaoView, CargoCrud, ComissaoCrud, PeriodoComposicaoCrud, ReunioesView, TipoComissaoCrud) -comissao_url_patterns, namespace = ComissaoCrud.get_urls() - -comissao_url_patterns = comissao_url_patterns + [ +comissao_url_patterns = ComissaoCrud.get_urls() + [ url(r'^(?P\d+)/composicao$', ComposicaoView.as_view(), name='composicao'), url(r'^(?P\d+)/materias-em-tramitacao$', @@ -29,7 +27,7 @@ comissao_url_patterns = comissao_url_patterns + [ ] urlpatterns = [ - url(r'^comissoes/', include(comissao_url_patterns, namespace)), + url(r'^comissoes/', include(comissao_url_patterns)), url(r'^sistema/comissoes/cargo/', include(CargoCrud.get_urls())), url(r'^sistema/comissoes/periodo-composicao/', diff --git a/crud/base.py b/crud/base.py index 0010209ee..c778cdb7a 100644 --- a/crud/base.py +++ b/crud/base.py @@ -55,12 +55,12 @@ def make_pagination(index, num_pages): class BaseMixin(CrispyLayoutFormMixin): - @property - def namespace(self): - return self.model._meta.model_name + @classmethod + def url_name(cls, suffix): + return '%s_%s' % (cls.model._meta.model_name, suffix) - def resolve_url(self, url_name, args=None): - return reverse('%s:%s' % (self.namespace, url_name), args=args) + def resolve_url(self, suffix, args=None): + return reverse(self.url_name(suffix), args=args) @property def list_url(self): @@ -195,17 +195,13 @@ class Crud: CrudUpdateView = _add_base(cls.UpdateView) CrudDeleteView = _add_base(cls.DeleteView) - urlpatterns = [ - url(r'^$', CrudListView.as_view(), name='list'), - url(r'^create$', CrudCreateView.as_view(), name='create'), - url(r'^(?P\d+)$', CrudDetailView.as_view(), name='detail'), - url(r'^(?P\d+)/edit$', - CrudUpdateView.as_view(), name='update'), - url(r'^(?P\d+)/delete$', - CrudDeleteView.as_view(), name='delete'), - ] - - return urlpatterns, _add_base(object)().namespace + return [url(regex, view.as_view(), name=view.url_name(suffix)) + for regex, view, suffix in [ + (r'^$', CrudListView, 'list'), + (r'^create$', CrudCreateView, 'create'), + (r'^(?P\d+)$', CrudDetailView, 'detail'), + (r'^(?P\d+)/edit$', CrudUpdateView, 'update'), + (r'^(?P\d+)/delete$', CrudDeleteView, 'delete'), ]] @classonlymethod def build(cls, _model, _help_path): diff --git a/crud/tests/test_base.py b/crud/tests/test_base.py index b8a94a4c9..2021b8447 100644 --- a/crud/tests/test_base.py +++ b/crud/tests/test_base.py @@ -140,11 +140,11 @@ def test_layout_detail_fieldsets(monkeypatch): def test_reverse(): - assert '/countries/' == reverse('country:list') - assert '/countries/create' == reverse('country:create') - assert '/countries/2' == reverse('country:detail', args=(2,)) - assert '/countries/2/edit' == reverse('country:update', args=(2,)) - assert '/countries/2/delete' == reverse('country:delete', args=(2,)) + assert '/countries/' == reverse('country_list') + assert '/countries/create' == reverse('country_create') + assert '/countries/2' == reverse('country_detail', args=(2,)) + assert '/countries/2/edit' == reverse('country_update', args=(2,)) + assert '/countries/2/delete' == reverse('country_delete', args=(2,)) def assert_h1(res, title): diff --git a/materia/urls.py b/materia/urls.py index 69b5c08a7..c19477a72 100644 --- a/materia/urls.py +++ b/materia/urls.py @@ -22,11 +22,8 @@ from materia.views import (AcompanhamentoConfirmarView, TramitacaoEditView, TramitacaoView, UnidadeTramitacaoCrud) -materia_legislativa_patterns, namespace = MateriaLegislativaCrud.get_urls() - - urlpatterns = [ - url(r'^materia/', include(materia_legislativa_patterns, namespace)), + url(r'^materia/', include(MateriaLegislativaCrud.get_urls())), url(r'^materia/(?P[0-9]+)/ta$', diff --git a/norma/urls.py b/norma/urls.py index ad3edf43a..0085740df 100644 --- a/norma/urls.py +++ b/norma/urls.py @@ -14,15 +14,13 @@ from norma.views import (AssuntoNormaCrud, NormaEditView, NormaIncluirView, # o código abaixo: # url(r'^norma/(?P[0-9]+)/ta$', NormaTaView.as_view(), name='ta') # bem como a classe NormaTaView que está em norma.views -norma_url_patterns, namespace = NormaTemporarioCrud.get_urls() - -norma_url_patterns += [ +norma_url_patterns = NormaTemporarioCrud.get_urls() + [ url(r'^norma/(?P[0-9]+)/ta$', NormaTaView.as_view(), name='ta') ] urlpatterns = [ - url(r'^norma/', include(norma_url_patterns, namespace)), + url(r'^norma/', include(norma_url_patterns)), url(r'^sistema/norma/tipo/', include(TipoNormaCrud.get_urls())), url(r'^sistema/norma/assunto/', include(AssuntoNormaCrud.get_urls())), diff --git a/sessao/urls.py b/sessao/urls.py index 95fba3701..79a9d471b 100644 --- a/sessao/urls.py +++ b/sessao/urls.py @@ -21,9 +21,7 @@ from sessao.views import (EditExpedienteOrdemDiaView, EditMateriaOrdemDiaView, VotacaoNominalExpedienteView, VotacaoNominalView, VotacaoView) -urlpatterns_sessao, namespace = SessaoCrud.get_urls() - -urlpatterns_sessao = urlpatterns_sessao + [ +urlpatterns_sessao = SessaoCrud.get_urls() + [ url(r'^(?P\d+)/expediente$', ExpedienteView.as_view(), name='expediente'), url(r'^(?P\d+)/presenca$', @@ -105,7 +103,7 @@ sessao_rest = [ ] urlpatterns = [ - url(r'^sessao/', include(urlpatterns_sessao, namespace)), + url(r'^sessao/', include(urlpatterns_sessao)), url(r'^media/(?P.*)$', serve, {'document_root': settings.MEDIA_ROOT}), url(r'^rest/', include(sessao_rest)), From 7568018b937045fdd4b8e67f0c878d552c8ba48b Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Fri, 11 Mar 2016 16:04:54 -0300 Subject: [PATCH 02/17] Refatora strings para constantes --- crud/base.py | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/crud/base.py b/crud/base.py index c778cdb7a..cfb223d6d 100644 --- a/crud/base.py +++ b/crud/base.py @@ -8,16 +8,19 @@ from django.views.generic import (CreateView, DeleteView, DetailView, ListView, from crispy_layout_mixin import CrispyLayoutFormMixin, get_field_display +LIST, CREATE, DETAIL, UPDATE, DELETE = \ + 'list', 'create', 'detail', 'update', 'delete' + def _form_invalid_message(msg): return '%s %s' % (_('Formulário inválido.'), msg) -FORM_MESSAGES = {'create': (_('Registro criado com sucesso!'), - _('O registro não foi criado.')), - 'update': (_('Registro alterado com sucesso!'), - _('Suas alterações não foram salvas.')), - 'delete': (_('Registro excluído com sucesso!'), - _('O registro não foi excluído.'))} +FORM_MESSAGES = {CREATE: (_('Registro criado com sucesso!'), + _('O registro não foi criado.')), + UPDATE: (_('Registro alterado com sucesso!'), + _('Suas alterações não foram salvas.')), + DELETE: (_('Registro excluído com sucesso!'), + _('O registro não foi excluído.'))} FORM_MESSAGES = {k: (a, _form_invalid_message(b)) for k, (a, b) in FORM_MESSAGES.items()} @@ -64,23 +67,23 @@ class BaseMixin(CrispyLayoutFormMixin): @property def list_url(self): - return self.resolve_url('list') + return self.resolve_url(LIST) @property def create_url(self): - return self.resolve_url('create') + return self.resolve_url(CREATE) @property def detail_url(self): - return self.resolve_url('detail', args=(self.object.id,)) + return self.resolve_url(DETAIL, args=(self.object.id,)) @property def update_url(self): - return self.resolve_url('update', args=(self.object.id,)) + return self.resolve_url(UPDATE, args=(self.object.id,)) @property def delete_url(self): - return self.resolve_url('delete', args=(self.object.id,)) + return self.resolve_url(DELETE, args=(self.object.id,)) def get_template_names(self): names = super(BaseMixin, self).get_template_names() @@ -131,7 +134,7 @@ class CrudListView(ListView): class CrudCreateView(FormMessagesMixin, CreateView): - form_valid_message, form_invalid_message = FORM_MESSAGES['create'] + form_valid_message, form_invalid_message = FORM_MESSAGES[CREATE] @property def cancel_url(self): @@ -148,7 +151,7 @@ class CrudCreateView(FormMessagesMixin, CreateView): class CrudUpdateView(FormMessagesMixin, UpdateView): - form_valid_message, form_invalid_message = FORM_MESSAGES['update'] + form_valid_message, form_invalid_message = FORM_MESSAGES[UPDATE] @property def cancel_url(self): @@ -160,7 +163,7 @@ class CrudUpdateView(FormMessagesMixin, UpdateView): class CrudDeleteView(FormMessagesMixin, DeleteView): - form_valid_message, form_invalid_message = FORM_MESSAGES['delete'] + form_valid_message, form_invalid_message = FORM_MESSAGES[DELETE] @property def cancel_url(self): @@ -197,11 +200,11 @@ class Crud: return [url(regex, view.as_view(), name=view.url_name(suffix)) for regex, view, suffix in [ - (r'^$', CrudListView, 'list'), - (r'^create$', CrudCreateView, 'create'), - (r'^(?P\d+)$', CrudDetailView, 'detail'), - (r'^(?P\d+)/edit$', CrudUpdateView, 'update'), - (r'^(?P\d+)/delete$', CrudDeleteView, 'delete'), ]] + (r'^$', CrudListView, LIST), + (r'^create$', CrudCreateView, CREATE), + (r'^(?P\d+)$', CrudDetailView, DETAIL), + (r'^(?P\d+)/edit$', CrudUpdateView, UPDATE), + (r'^(?P\d+)/delete$', CrudDeleteView, DELETE), ]] @classonlymethod def build(cls, _model, _help_path): From 8fd4f08ae0992e3c092f77905de53462ae0b93f9 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Wed, 16 Mar 2016 19:04:44 -0300 Subject: [PATCH 03/17] Usa app_name como namespace no crud --- crud/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crud/base.py b/crud/base.py index cfb223d6d..48bcb1e62 100644 --- a/crud/base.py +++ b/crud/base.py @@ -63,7 +63,9 @@ class BaseMixin(CrispyLayoutFormMixin): return '%s_%s' % (cls.model._meta.model_name, suffix) def resolve_url(self, suffix, args=None): - return reverse(self.url_name(suffix), args=args) + namespace = self.model._meta.app_label + return reverse('%s:%s' % (namespace, self.url_name(suffix)), + args=args) @property def list_url(self): From 86793f1ad9e33a64258390ada7ffb436c24ebc3c Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Wed, 16 Mar 2016 21:00:58 -0300 Subject: [PATCH 04/17] Define namespace em urls.py via app_name --- base/__init__.py | 2 +- base/apps.py | 4 ++-- base/urls.py | 3 +++ comissoes/__init__.py | 2 +- comissoes/apps.py | 4 ++-- comissoes/urls.py | 6 ++++++ compilacao/apps.py | 4 ++-- compilacao/urls.py | 4 ++++ crud/tests/stub_app/urls.py | 2 +- crud/tests/test_base.py | 11 ++++++----- crud/urls.py | 5 +++++ lexml/__init__.py | 2 +- lexml/apps.py | 4 ++-- lexml/urls.py | 4 ++++ materia/__init__.py | 2 +- materia/apps.py | 4 ++-- materia/urls.py | 4 ++++ norma/__init__.py | 2 +- norma/apps.py | 4 ++-- norma/urls.py | 4 ++++ painel/__init__.py | 1 + painel/apps.py | 7 +++++++ painel/urls.py | 3 +++ parlamentares/__init__.py | 2 +- parlamentares/apps.py | 4 ++-- parlamentares/urls.py | 4 ++++ protocoloadm/__init__.py | 2 +- protocoloadm/apps.py | 4 ++-- protocoloadm/urls.py | 4 ++++ relatorios/__init__.py | 1 + relatorios/apps.py | 7 +++++++ relatorios/urls.py | 3 +++ sessao/__init__.py | 2 +- sessao/apps.py | 4 ++-- sessao/urls.py | 4 ++++ 35 files changed, 97 insertions(+), 32 deletions(-) create mode 100644 crud/urls.py create mode 100644 painel/apps.py create mode 100644 relatorios/apps.py diff --git a/base/__init__.py b/base/__init__.py index 579b5a023..bbf993376 100644 --- a/base/__init__.py +++ b/base/__init__.py @@ -1 +1 @@ -default_app_config = 'base.apps.BaseAppConfig' +default_app_config = 'base.apps.AppConfig' diff --git a/base/apps.py b/base/apps.py index e11a474b4..cb73158bb 100644 --- a/base/apps.py +++ b/base/apps.py @@ -1,7 +1,7 @@ -from django.apps import AppConfig +from django import apps from django.utils.translation import ugettext_lazy as _ -class BaseAppConfig(AppConfig): +class AppConfig(apps.AppConfig): name = 'base' verbose_name = _('Dados Básicos') diff --git a/base/urls.py b/base/urls.py index f7806f843..4ddb4532a 100644 --- a/base/urls.py +++ b/base/urls.py @@ -2,8 +2,11 @@ from django.conf.urls import url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.views.generic.base import TemplateView +from .apps import AppConfig from .views import CasaLegislativaTableAuxView, HelpView +app_name = AppConfig.name + urlpatterns = [ url(r'^sistema/', TemplateView.as_view(template_name='sistema.html')), url(r'^ajuda/(?P\w+)$', HelpView.as_view(), name='help_topic'), diff --git a/comissoes/__init__.py b/comissoes/__init__.py index 76fa7e087..78f813284 100644 --- a/comissoes/__init__.py +++ b/comissoes/__init__.py @@ -1 +1 @@ -default_app_config = 'comissoes.apps.ComissoesAppConfig' +default_app_config = 'comissoes.apps.AppConfig' diff --git a/comissoes/apps.py b/comissoes/apps.py index 906f1d04b..e37de82c1 100644 --- a/comissoes/apps.py +++ b/comissoes/apps.py @@ -1,7 +1,7 @@ -from django.apps import AppConfig +from django import apps from django.utils.translation import ugettext_lazy as _ -class ComissoesAppConfig(AppConfig): +class AppConfig(apps.AppConfig): name = 'comissoes' verbose_name = _('Comissões') diff --git a/comissoes/urls.py b/comissoes/urls.py index bff625ee0..6a7e44ef4 100644 --- a/comissoes/urls.py +++ b/comissoes/urls.py @@ -7,6 +7,10 @@ from comissoes.views import (CadastrarComissaoView, CargoCrud, ComissaoCrud, PeriodoComposicaoCrud, ReunioesView, TipoComissaoCrud) +from .apps import AppConfig + +app_name = AppConfig.name + comissao_url_patterns = ComissaoCrud.get_urls() + [ url(r'^(?P\d+)/composicao$', ComposicaoView.as_view(), name='composicao'), @@ -26,6 +30,8 @@ comissao_url_patterns = ComissaoCrud.get_urls() + [ CadastrarComissaoView.as_view(), name='cadastrar_comissao'), ] +app_name = AppConfig.name + urlpatterns = [ url(r'^comissoes/', include(comissao_url_patterns)), diff --git a/compilacao/apps.py b/compilacao/apps.py index 8cab3c8fb..5d56706ba 100644 --- a/compilacao/apps.py +++ b/compilacao/apps.py @@ -1,7 +1,7 @@ -from django.apps import AppConfig +from django import apps from django.utils.translation import ugettext_lazy as _ -class CompilacaoAppConfig(AppConfig): +class AppConfig(apps.AppConfig): name = 'compilacao' verbose_name = _('Compilação') diff --git a/compilacao/urls.py b/compilacao/urls.py index e11fad89c..b3329a16d 100644 --- a/compilacao/urls.py +++ b/compilacao/urls.py @@ -4,6 +4,10 @@ from compilacao import views from compilacao.views import (TipoNotaCrud, TipoPublicacaoCrud, TipoVideCrud, VeiculoPublicacaoCrud) +from .apps import AppConfig + +app_name = AppConfig.name + urlpatterns_compilacao = [ url(r'^$', views.TaListView.as_view(), name='ta_list'), url(r'^create$', views.TaCreateView.as_view(), name='ta_create'), diff --git a/crud/tests/stub_app/urls.py b/crud/tests/stub_app/urls.py index 3224f5c1a..66f7fed14 100644 --- a/crud/tests/stub_app/urls.py +++ b/crud/tests/stub_app/urls.py @@ -3,5 +3,5 @@ from django.conf.urls import include, url from .views import CountryCrud urlpatterns = [ - url(r'^countries/', include(CountryCrud.get_urls())), + url(r'^countries/', include(CountryCrud.get_urls(), 'stub_app')), ] diff --git a/crud/tests/test_base.py b/crud/tests/test_base.py index 2021b8447..f8379fb8a 100644 --- a/crud/tests/test_base.py +++ b/crud/tests/test_base.py @@ -140,11 +140,12 @@ def test_layout_detail_fieldsets(monkeypatch): def test_reverse(): - assert '/countries/' == reverse('country_list') - assert '/countries/create' == reverse('country_create') - assert '/countries/2' == reverse('country_detail', args=(2,)) - assert '/countries/2/edit' == reverse('country_update', args=(2,)) - assert '/countries/2/delete' == reverse('country_delete', args=(2,)) + assert '/countries/' == reverse('stub_app:country_list') + assert '/countries/create' == reverse('stub_app:country_create') + assert '/countries/2' == reverse('stub_app:country_detail', args=(2,)) + assert '/countries/2/edit' == reverse('stub_app:country_update', args=(2,)) + assert '/countries/2/delete' == reverse( + 'stub_app:country_delete', args=(2,)) def assert_h1(res, title): diff --git a/crud/urls.py b/crud/urls.py new file mode 100644 index 000000000..8b7da50fe --- /dev/null +++ b/crud/urls.py @@ -0,0 +1,5 @@ +from django.conf.urls import include, url + +urlpatterns = [ + url(r'', include('stub_app.urls')), +] diff --git a/lexml/__init__.py b/lexml/__init__.py index 4a85a35ba..b9a440a35 100644 --- a/lexml/__init__.py +++ b/lexml/__init__.py @@ -1 +1 @@ -default_app_config = 'lexml.apps.LexmlAppConfig' +default_app_config = 'lexml.apps.AppConfig' diff --git a/lexml/apps.py b/lexml/apps.py index b72fc8ea3..4098530b0 100644 --- a/lexml/apps.py +++ b/lexml/apps.py @@ -1,7 +1,7 @@ -from django.apps import AppConfig +from django import apps from django.utils.translation import ugettext_lazy as _ -class LexmlAppConfig(AppConfig): +class AppConfig(apps.AppConfig): name = 'lexml' verbose_name = _('LexML') diff --git a/lexml/urls.py b/lexml/urls.py index 43935a8b1..08258d079 100644 --- a/lexml/urls.py +++ b/lexml/urls.py @@ -2,6 +2,10 @@ from django.conf.urls import include, url from lexml.views import LexmlProvedorCrud, LexmlPublicadorCrud +from .apps import AppConfig + +app_name = AppConfig.name + urlpatterns = [ url(r'^sistema/lexml/provedor/', include(LexmlProvedorCrud.get_urls())), diff --git a/materia/__init__.py b/materia/__init__.py index 269adab59..7d2cd33d2 100644 --- a/materia/__init__.py +++ b/materia/__init__.py @@ -1 +1 @@ -default_app_config = 'materia.apps.MateriaAppConfig' +default_app_config = 'materia.apps.AppConfig' diff --git a/materia/apps.py b/materia/apps.py index 2c6d5591b..759206443 100644 --- a/materia/apps.py +++ b/materia/apps.py @@ -1,7 +1,7 @@ -from django.apps import AppConfig +from django import apps from django.utils.translation import ugettext_lazy as _ -class MateriaAppConfig(AppConfig): +class AppConfig(apps.AppConfig): name = 'materia' verbose_name = _('Matéria') diff --git a/materia/urls.py b/materia/urls.py index c19477a72..128cbc103 100644 --- a/materia/urls.py +++ b/materia/urls.py @@ -22,6 +22,10 @@ from materia.views import (AcompanhamentoConfirmarView, TramitacaoEditView, TramitacaoView, UnidadeTramitacaoCrud) +from .apps import AppConfig + +app_name = AppConfig.name + urlpatterns = [ url(r'^materia/', include(MateriaLegislativaCrud.get_urls())), diff --git a/norma/__init__.py b/norma/__init__.py index 6254dc544..5c4701e00 100644 --- a/norma/__init__.py +++ b/norma/__init__.py @@ -1 +1 @@ -default_app_config = 'norma.apps.NormaAppConfig' +default_app_config = 'norma.apps.AppConfig' diff --git a/norma/apps.py b/norma/apps.py index 14856aa71..424c2e996 100644 --- a/norma/apps.py +++ b/norma/apps.py @@ -1,7 +1,7 @@ -from django.apps import AppConfig +from django import apps from django.utils.translation import ugettext_lazy as _ -class NormaAppConfig(AppConfig): +class AppConfig(apps.AppConfig): name = 'norma' verbose_name = _('Norma Jurídica') diff --git a/norma/urls.py b/norma/urls.py index 0085740df..d68fd36a5 100644 --- a/norma/urls.py +++ b/norma/urls.py @@ -4,6 +4,10 @@ from norma.views import (AssuntoNormaCrud, NormaEditView, NormaIncluirView, NormaPesquisaView, NormaTaView, NormaTemporarioCrud, PesquisaNormaListView, TipoNormaCrud) +from .apps import AppConfig + +app_name = AppConfig.name + # @LeandroRoberto comentou em # https://github.com/interlegis/sapl/pull/255#discussion_r55894269 # diff --git a/painel/__init__.py b/painel/__init__.py index e69de29bb..1eedfa389 100644 --- a/painel/__init__.py +++ b/painel/__init__.py @@ -0,0 +1 @@ +default_app_config = 'painel.apps.AppConfig' diff --git a/painel/apps.py b/painel/apps.py new file mode 100644 index 000000000..1b46b6eba --- /dev/null +++ b/painel/apps.py @@ -0,0 +1,7 @@ +from django import apps +from django.utils.translation import ugettext_lazy as _ + + +class AppConfig(apps.AppConfig): + name = 'painel' + verbose_name = _('Painel Eletrônico') diff --git a/painel/urls.py b/painel/urls.py index 1c7ad55f3..b210bff05 100644 --- a/painel/urls.py +++ b/painel/urls.py @@ -1,10 +1,13 @@ from django.conf.urls import url +from .apps import AppConfig from .views import controlador_painel # CronometroPainelCrud, from .views import (cronometro_painel, get_dados_painel, painel_mensagem_view, painel_parlamentares_view, painel_view, painel_votacao_view) +app_name = AppConfig.name + urlpatterns = [ url(r'^(?P\d+)/painel$', painel_view, name="painel_principal"), url(r'^painel/(?P\d+)/dados$', get_dados_painel, name='dados_painel'), diff --git a/parlamentares/__init__.py b/parlamentares/__init__.py index 9a89f1ce7..ffec8e2fb 100644 --- a/parlamentares/__init__.py +++ b/parlamentares/__init__.py @@ -1 +1 @@ -default_app_config = 'parlamentares.apps.ParlamentaresAppConfig' +default_app_config = 'parlamentares.apps.AppConfig' diff --git a/parlamentares/apps.py b/parlamentares/apps.py index 0b3610405..6dc201aa3 100644 --- a/parlamentares/apps.py +++ b/parlamentares/apps.py @@ -1,7 +1,7 @@ -from django.apps import AppConfig +from django import apps from django.utils.translation import ugettext_lazy as _ -class ParlamentaresAppConfig(AppConfig): +class AppConfig(apps.AppConfig): name = 'parlamentares' verbose_name = _('Parlamentares') diff --git a/parlamentares/urls.py b/parlamentares/urls.py index e853c6908..c7a9f922c 100644 --- a/parlamentares/urls.py +++ b/parlamentares/urls.py @@ -12,6 +12,10 @@ from parlamentares.views import (CargoMesaCrud, ColigacaoCrud, TipoAfastamentoCrud, TipoDependenteCrud, TipoMilitarCrud) +from .apps import AppConfig + +app_name = AppConfig.name + urlpatterns = [ url(r'^sistema/parlamentares/legislatura/', include(LegislaturaCrud.get_urls())), diff --git a/protocoloadm/__init__.py b/protocoloadm/__init__.py index 3b0043a9f..c9bbe85bf 100644 --- a/protocoloadm/__init__.py +++ b/protocoloadm/__init__.py @@ -1 +1 @@ -default_app_config = 'protocoloadm.apps.ProtocoloadmAppConfig' +default_app_config = 'protocoloadm.apps.AppConfig' diff --git a/protocoloadm/apps.py b/protocoloadm/apps.py index c163d149c..dbba33948 100644 --- a/protocoloadm/apps.py +++ b/protocoloadm/apps.py @@ -1,7 +1,7 @@ -from django.apps import AppConfig +from django import apps from django.utils.translation import ugettext_lazy as _ -class ProtocoloadmAppConfig(AppConfig): +class AppConfig(apps.AppConfig): name = 'protocoloadm' verbose_name = _('Protocolo Administrativo') diff --git a/protocoloadm/urls.py b/protocoloadm/urls.py index 51e98b2f9..6e2103ac0 100644 --- a/protocoloadm/urls.py +++ b/protocoloadm/urls.py @@ -24,6 +24,10 @@ from protocoloadm.views import (AnularProtocoloAdmView, TramitacaoAdministrativoCrud, TramitacaoAdmView, pesquisa_autores) +from .apps import AppConfig + +app_name = AppConfig.name + urlpatterns = [ url(r'^protocoloadm/docadm/', include(DocumentoAdministrativoCrud.get_urls())), diff --git a/relatorios/__init__.py b/relatorios/__init__.py index e69de29bb..6f40d706f 100644 --- a/relatorios/__init__.py +++ b/relatorios/__init__.py @@ -0,0 +1 @@ +default_app_config = 'relatorios.apps.AppConfig' diff --git a/relatorios/apps.py b/relatorios/apps.py new file mode 100644 index 000000000..3421e151a --- /dev/null +++ b/relatorios/apps.py @@ -0,0 +1,7 @@ +from django import apps +from django.utils.translation import ugettext_lazy as _ + + +class AppConfig(apps.AppConfig): + name = 'relatorios' + verbose_name = _('Relatórios') diff --git a/relatorios/urls.py b/relatorios/urls.py index ee6fb462c..9dbcbbec0 100644 --- a/relatorios/urls.py +++ b/relatorios/urls.py @@ -1,11 +1,14 @@ from django.conf.urls import url +from .apps import AppConfig from .views import (relatorio_capa_processo, relatorio_documento_administrativo, relatorio_espelho, relatorio_etiqueta_protocolo, relatorio_materia, relatorio_ordem_dia, relatorio_pauta_sessao, relatorio_protocolo, relatorio_sessao_plenaria) +app_name = AppConfig.name + urlpatterns = [ url(r'^relatorios/materia$', relatorio_materia, name='relatorio_materia'), url(r'^relatorios/capa_processo$', diff --git a/sessao/__init__.py b/sessao/__init__.py index 00fc7696d..e036d8daf 100644 --- a/sessao/__init__.py +++ b/sessao/__init__.py @@ -1 +1 @@ -default_app_config = 'sessao.apps.SessaoAppConfig' +default_app_config = 'sessao.apps.AppConfig' diff --git a/sessao/apps.py b/sessao/apps.py index 61cc61856..a222471b8 100644 --- a/sessao/apps.py +++ b/sessao/apps.py @@ -1,7 +1,7 @@ -from django.apps import AppConfig +from django import apps from django.utils.translation import ugettext_lazy as _ -class SessaoAppConfig(AppConfig): +class AppConfig(apps.AppConfig): name = 'sessao' verbose_name = _('Sessão Plenária') diff --git a/sessao/urls.py b/sessao/urls.py index 79a9d471b..0710e74b9 100644 --- a/sessao/urls.py +++ b/sessao/urls.py @@ -21,6 +21,10 @@ from sessao.views import (EditExpedienteOrdemDiaView, EditMateriaOrdemDiaView, VotacaoNominalExpedienteView, VotacaoNominalView, VotacaoView) +from .apps import AppConfig + +app_name = AppConfig.name + urlpatterns_sessao = SessaoCrud.get_urls() + [ url(r'^(?P\d+)/expediente$', ExpedienteView.as_view(), name='expediente'), From c340721c7cc7d32f0f8dd1de49a00cd8fee36d25 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Wed, 16 Mar 2016 21:26:28 -0300 Subject: [PATCH 05/17] Ajusta namespaces para padrao app_name --- base/templatetags/menus.py | 14 +++--- materia/views.py | 6 +-- sessao/views.py | 46 +++++++++---------- templates/base.html | 20 ++++---- templates/comissoes/subnav.yaml | 6 +-- templates/materia/subnav.yaml | 2 +- .../sessao/expediente_ordemdia_list.html | 20 ++++---- templates/sessao/explicacao.html | 4 +- templates/sessao/materia_ordemdia_list.html | 20 ++++---- templates/sessao/orador_expediente.html | 4 +- templates/sessao/pauta_sessao_detail.html | 4 +- templates/sessao/pauta_sessao_list.html | 2 +- templates/sessao/sessao_list.html | 4 +- templates/sessao/subnav.yaml | 22 ++++----- templates/sistema.html | 2 +- 15 files changed, 89 insertions(+), 87 deletions(-) diff --git a/base/templatetags/menus.py b/base/templatetags/menus.py index bd218fca3..fdc6ea379 100644 --- a/base/templatetags/menus.py +++ b/base/templatetags/menus.py @@ -21,20 +21,22 @@ def subnav(context, path=None): menu = None if 'object' in context: obj = context['object'] - default_path = '%s/subnav.yaml' % obj.__class__._meta.app_label + app = obj.__class__._meta.app_label + default_path = '%s/subnav.yaml' % app path = os.path.join(TEMPLATES_DIR, path or default_path) if os.path.exists(path): menu = yaml.load(open(path, 'r')) - resolve_urls_inplace(menu, obj.pk) + resolve_urls_inplace(menu, obj.pk, app) return dict(menu=menu) -def resolve_urls_inplace(menu, pk): +def resolve_urls_inplace(menu, pk, app): if isinstance(menu, list): for item in menu: - resolve_urls_inplace(item, pk) + resolve_urls_inplace(item, pk, app) else: if 'url' in menu: - menu['url'] = reverse(menu['url'], kwargs={'pk': pk}) + menu['url'] = reverse('%s:%s' % (app, menu['url']), + kwargs={'pk': pk}) if 'children' in menu: - resolve_urls_inplace(menu['children'], pk) + resolve_urls_inplace(menu['children'], pk, app) diff --git a/materia/views.py b/materia/views.py index f68fdacc6..0ca240ebc 100644 --- a/materia/views.py +++ b/materia/views.py @@ -539,7 +539,7 @@ class DocumentoAcessorioView(CreateView): class AcompanhamentoConfirmarView(TemplateView): def get_redirect_url(self): - return reverse("sessaoplenaria:list_pauta_sessao") + return reverse("sessao:list_pauta_sessao") def get(self, request, *args, **kwargs): materia_id = kwargs['pk'] @@ -556,7 +556,7 @@ class AcompanhamentoConfirmarView(TemplateView): class AcompanhamentoExcluirView(TemplateView): def get_redirect_url(self): - return reverse("sessaoplenaria:list_pauta_sessao") + return reverse("sessao:list_pauta_sessao") def get(self, request, *args, **kwargs): materia_id = kwargs['pk'] @@ -1469,4 +1469,4 @@ class AcompanhamentoMateriaView(MateriaLegislativaCrud.CrudDetailView): 'materia': materia}) def get_success_url(self): - return reverse('sessaoplenaria:list_pauta_sessao') + return reverse('sessao:list_pauta_sessao') diff --git a/sessao/views.py b/sessao/views.py index 9fdf858a8..2977c3e74 100644 --- a/sessao/views.py +++ b/sessao/views.py @@ -93,7 +93,7 @@ class PresencaView(FormMixin, PresencaMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:presenca', kwargs={'pk': pk}) + return reverse('sessao:presenca', kwargs={'pk': pk}) class PainelView(SessaoCrud.CrudDetailView): @@ -142,7 +142,7 @@ class PresencaOrdemDiaView(FormMixin, def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:presencaordemdia', kwargs={'pk': pk}) + return reverse('sessao:presencaordemdia', kwargs={'pk': pk}) class ListMateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView): @@ -409,7 +409,7 @@ class MateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:materiaordemdia_list', + return reverse('sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -520,7 +520,7 @@ class EditMateriaOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:materiaordemdia_list', + return reverse('sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -586,7 +586,7 @@ class ExpedienteOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:expedienteordemdia_list', + return reverse('sessao:expedienteordemdia_list', kwargs={'pk': pk}) @@ -669,7 +669,7 @@ class EditExpedienteOrdemDiaView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:expedienteordemdia_list', + return reverse('sessao:expedienteordemdia_list', kwargs={'pk': pk}) @@ -695,7 +695,7 @@ class OradorExpedienteDelete(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:oradorexpediente', kwargs={'pk': pk}) + return reverse('sessao:oradorexpediente', kwargs={'pk': pk}) class OradorExpedienteEdit(FormMixin, SessaoCrud.CrudDetailView): @@ -755,7 +755,7 @@ class OradorExpedienteEdit(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:oradorexpediente', kwargs={'pk': pk}) + return reverse('sessao:oradorexpediente', kwargs={'pk': pk}) class OradorExpedienteView(FormMixin, SessaoCrud.CrudDetailView): @@ -825,7 +825,7 @@ class OradorExpedienteView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:oradorexpediente', kwargs={'pk': pk}) + return reverse('sessao:oradorexpediente', kwargs={'pk': pk}) class MesaView(FormMixin, SessaoCrud.CrudDetailView): @@ -919,7 +919,7 @@ class MesaView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:mesa', kwargs={'pk': pk}) + return reverse('sessao:mesa', kwargs={'pk': pk}) class ResumoView(SessaoCrud.CrudDetailView): @@ -1159,7 +1159,7 @@ class ExpedienteView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:expediente', kwargs={'pk': pk}) + return reverse('sessao:expediente', kwargs={'pk': pk}) class ExplicacaoView(FormMixin, SessaoCrud.CrudDetailView): @@ -1229,7 +1229,7 @@ class ExplicacaoView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:explicacao', kwargs={'pk': pk}) + return reverse('sessao:explicacao', kwargs={'pk': pk}) class ExplicacaoDelete(FormMixin, SessaoCrud.CrudDetailView): @@ -1252,7 +1252,7 @@ class ExplicacaoDelete(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:explicacao', kwargs={'pk': pk}) + return reverse('sessao:explicacao', kwargs={'pk': pk}) class ExplicacaoEdit(FormMixin, SessaoCrud.CrudDetailView): @@ -1312,7 +1312,7 @@ class ExplicacaoEdit(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:explicacao', kwargs={'pk': pk}) + return reverse('sessao:explicacao', kwargs={'pk': pk}) class VotacaoEditView(FormMixin, SessaoCrud.CrudDetailView): @@ -1384,7 +1384,7 @@ class VotacaoEditView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:materiaordemdia_list', + return reverse('sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -1503,7 +1503,7 @@ class VotacaoView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:materiaordemdia_list', + return reverse('sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -1630,7 +1630,7 @@ class VotacaoNominalView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:materiaordemdia_list', + return reverse('sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -1707,7 +1707,7 @@ class VotacaoNominalEditView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:materiaordemdia_list', + return reverse('sessao:materiaordemdia_list', kwargs={'pk': pk}) @@ -1832,7 +1832,7 @@ class VotacaoNominalExpedienteView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:expedienteordemdia_list', + return reverse('sessao:expedienteordemdia_list', kwargs={'pk': pk}) @@ -1909,7 +1909,7 @@ class VotacaoNominalExpedienteEditView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:expedienteordemdia_list', + return reverse('sessao:expedienteordemdia_list', kwargs={'pk': pk}) @@ -2030,7 +2030,7 @@ class VotacaoExpedienteView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:expedienteordemdia_list', + return reverse('sessao:expedienteordemdia_list', kwargs={'pk': pk}) @@ -2045,7 +2045,7 @@ class VotacaoExpedienteEditView(FormMixin, SessaoCrud.CrudDetailView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('sessaoplenaria:expedienteordemdia_list', + return reverse('sessao:expedienteordemdia_list', kwargs={'pk': pk}) def get_tipos_votacao(self): @@ -2236,7 +2236,7 @@ class PautaSessaoDetailView(SessaoCrud.CrudDetailView): class SessaoCadastroView(CreateView): template_name = "sessao/sessao_cadastro.html" form_class = SessaoForm - success_url = reverse_lazy('sessaoplenaria:list_sessao') + success_url = reverse_lazy('sessao:list_sessao') class SessaoPlenariaView(generics.ListAPIView): diff --git a/templates/base.html b/templates/base.html index b771c69ed..f629e8bd8 100644 --- a/templates/base.html +++ b/templates/base.html @@ -46,30 +46,30 @@ diff --git a/templates/comissoes/subnav.yaml b/templates/comissoes/subnav.yaml index bfcefee34..7ac544f9c 100644 --- a/templates/comissoes/subnav.yaml +++ b/templates/comissoes/subnav.yaml @@ -1,6 +1,6 @@ - title: Início - url: comissao:detail + url: comissao_detail - title: Composição - url: comissao:composicao + url: comissao_composicao - title: Matérias em Tramitação - url: comissao:materias_em_tramitacao + url: comissao_materias_em_tramitacao diff --git a/templates/materia/subnav.yaml b/templates/materia/subnav.yaml index 5aca57c4b..049f16388 100644 --- a/templates/materia/subnav.yaml +++ b/templates/materia/subnav.yaml @@ -1,5 +1,5 @@ - title: Início - url: materialegislativa:detail + url: materialegislativa_detail - title: Anexada url: materia_anexada - title: Autoria diff --git a/templates/sessao/expediente_ordemdia_list.html b/templates/sessao/expediente_ordemdia_list.html index 36c50976c..5b45eca4f 100644 --- a/templates/sessao/expediente_ordemdia_list.html +++ b/templates/sessao/expediente_ordemdia_list.html @@ -30,7 +30,7 @@ Matérias do Expediente {% for m in materias_ordem %} - {{m.numero}} - {{m.titulo}} + {{m.numero}} - {{m.titulo}}  
Autor{{m.autor|length|pluralize:"es"}}: {{m.autor|join:', '}} @@ -41,24 +41,24 @@ Matérias do Expediente {% if m.resultado %} {% if m.tipo_votacao == 1 %} - {{m.resultado}} + {{m.resultado}} {% elif m.tipo_votacao == 2 %} - {{m.resultado}} + {{m.resultado}} {% elif m.tipo_votacao == 3%} - {{m.resultado}} + {{m.resultado}} {% endif %} {% else %} Matéria não votada
{% if m.votacao_aberta %} {% if m.tipo_votacao == 1 %} - Registrar Votação + Registrar Votação {% elif m.tipo_votacao == 2 %} - Registrar Votação + Registrar Votação {% elif m.tipo_votacao == 3%} - Registrar Votação + Registrar Votação {% endif %} {% else %} -
+ {% csrf_token %} @@ -71,10 +71,10 @@ Matérias do Expediente {% endfor %}
- + {% csrf_token %} - {% trans 'Adicionar Matérias' %} + {% trans 'Adicionar Matérias' %}         diff --git a/templates/sessao/explicacao.html b/templates/sessao/explicacao.html index e242b5a12..bd1f922a0 100644 --- a/templates/sessao/explicacao.html +++ b/templates/sessao/explicacao.html @@ -21,8 +21,8 @@ {{parlamentar.nome_parlamentar }} {% if not url_discurso %}Orador sem discurso cadastrado{% else %}{{url_discurso}}{% endif %} - Editar - Excluir + Editar + Excluir {% endfor %} diff --git a/templates/sessao/materia_ordemdia_list.html b/templates/sessao/materia_ordemdia_list.html index a2a018dca..8ac7d81be 100644 --- a/templates/sessao/materia_ordemdia_list.html +++ b/templates/sessao/materia_ordemdia_list.html @@ -30,7 +30,7 @@ Matérias da Ordem do Dia {% for m in materias_ordem %} - {{m.numero}} - {{m.titulo}} + {{m.numero}} - {{m.titulo}}  
Autor{{m.autor|length|pluralize:"es"}}: {{m.autor|join:', '}} @@ -41,24 +41,24 @@ Matérias da Ordem do Dia {% if m.resultado %} {% if m.tipo_votacao == 1 %} - {{m.resultado}} + {{m.resultado}} {% elif m.tipo_votacao == 2 %} - {{m.resultado}} + {{m.resultado}} {% elif m.tipo_votacao == 3%} - {{m.resultado}} + {{m.resultado}} {% endif %} {% else %} Matéria não votada
{% if m.votacao_aberta %} {% if m.tipo_votacao == 1 %} - Registrar Votação + Registrar Votação {% elif m.tipo_votacao == 2 %} - Registrar Votação + Registrar Votação {% elif m.tipo_votacao == 3%} - Registrar Votação + Registrar Votação {% endif %} {% else %} - + {% csrf_token %} @@ -71,10 +71,10 @@ Matérias da Ordem do Dia
- + {% csrf_token %} - {% trans 'Adicionar Matérias' %} + {% trans 'Adicionar Matérias' %}         diff --git a/templates/sessao/orador_expediente.html b/templates/sessao/orador_expediente.html index 5375fa865..915224256 100644 --- a/templates/sessao/orador_expediente.html +++ b/templates/sessao/orador_expediente.html @@ -21,8 +21,8 @@ {{parlamentar.nome_parlamentar }} {% if not url_discurso %}Orador sem discurso cadastrado{% else %}{{url_discurso}}{% endif %} - Editar - Excluir + Editar + Excluir {% endfor %} diff --git a/templates/sessao/pauta_sessao_detail.html b/templates/sessao/pauta_sessao_detail.html index 6c806a2e9..4a26e389b 100644 --- a/templates/sessao/pauta_sessao_detail.html +++ b/templates/sessao/pauta_sessao_detail.html @@ -39,7 +39,7 @@
{% for m in materia_expediente %}
- {{m.numero}} - {{m.titulo}} + {{m.numero}} - {{m.titulo}}
Autor{{ m.autor|length|pluralize:"es" }}: {{ m.autor|join:', ' }}
@@ -73,7 +73,7 @@
{% for m in materias_ordem %}
- {{m.numero}} - {{m.titulo}} + {{m.numero}} - {{m.titulo}}
Autor{{ m.autor|length|pluralize:"es" }}: {{ m.autor|join:', ' }}
diff --git a/templates/sessao/pauta_sessao_list.html b/templates/sessao/pauta_sessao_list.html index e0bb5c135..e18c5b099 100644 --- a/templates/sessao/pauta_sessao_list.html +++ b/templates/sessao/pauta_sessao_list.html @@ -8,7 +8,7 @@ {% for sessao in page_obj %} - {{sessao}} + {{sessao}}
Data: {{sessao.data_inicio}} - Abertura {{sessao.hora_inicio}} diff --git a/templates/sessao/sessao_list.html b/templates/sessao/sessao_list.html index e005802a1..cb315af26 100644 --- a/templates/sessao/sessao_list.html +++ b/templates/sessao/sessao_list.html @@ -5,7 +5,7 @@ {% block base_content %} @@ -14,7 +14,7 @@ {% for sessao in page_obj %} - {{sessao}} + {{sessao}}
Data: {{sessao.data_inicio}} - Abertura {{sessao.hora_inicio}} diff --git a/templates/sessao/subnav.yaml b/templates/sessao/subnav.yaml index 09682f81a..1b096237a 100644 --- a/templates/sessao/subnav.yaml +++ b/templates/sessao/subnav.yaml @@ -1,32 +1,32 @@ - title: Abertura children: - title: Dados Básicos - url: sessaoplenaria:detail + url: sessaoplenaria_detail - title: Mesa - url: sessaoplenaria:mesa + url: mesa - title: Presença - url: sessaoplenaria:presenca + url: presenca - title: Explicações Pessoais - url: sessaoplenaria:explicacao + url: explicacao - title: Expedientes children: - title: Expediente Diversos - url: sessaoplenaria:expediente + url: expediente - title: Matérias Expediente - url: sessaoplenaria:expedienteordemdia_list + url: expedienteordemdia_list - title: Oradores do Expediente - url: sessaoplenaria:oradorexpediente + url: oradorexpediente - title: Ordem do Dia children: - title: Matérias Ordem do Dia - url: sessaoplenaria:materiaordemdia_list + url: materiaordemdia_list - title: Presença Ordem do Dia - url: sessaoplenaria:presencaordemdia + url: presencaordemdia - title: Painel Eletrônico - url: sessaoplenaria:painel + url: painel - title: Resumo - url: sessaoplenaria:resumo + url: resumo diff --git a/templates/sistema.html b/templates/sistema.html index 224fc0319..1a083ec5d 100644 --- a/templates/sistema.html +++ b/templates/sistema.html @@ -66,7 +66,7 @@

Módulo Sessão Plenária

- + From 71088ed3692b342af44f851130d4d900ee0d654f Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Thu, 17 Mar 2016 12:47:33 -0300 Subject: [PATCH 06/17] Modifica namespaces --- materia/views.py | 4 ++-- norma/views.py | 8 ++++---- templates/comissoes/materias_em_tramitacao.html | 2 +- templates/materia/materialegislativa_list.html | 4 ++-- templates/materia/pesquisa_materia_list.html | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/materia/views.py b/materia/views.py index 0ca240ebc..df3e31c0a 100644 --- a/materia/views.py +++ b/materia/views.py @@ -58,7 +58,7 @@ TramitacaoCrud = Crud.build(Tramitacao, '') class FormularioSimplificadoView(CreateView): template_name = "materia/formulario_simplificado.html" form_class = FormularioSimplificadoForm - success_url = reverse_lazy('materialegislativa:list') + success_url = reverse_lazy('materia:materia_list') class FormularioCadastroView(CreateView): @@ -223,7 +223,7 @@ class MateriaAnexadaEditView(FormView): else: return self.render_to_response( {'form': form, - 'materialegislativa': mat_principal}) + 'materia': mat_principal}) def get_success_url(self): pk = self.kwargs['pk'] diff --git a/norma/views.py b/norma/views.py index 8f97224f1..3594f38d2 100644 --- a/norma/views.py +++ b/norma/views.py @@ -16,13 +16,13 @@ from .models import (AssuntoNorma, LegislacaoCitada, NormaJuridica, AssuntoNormaCrud = Crud.build(AssuntoNorma, 'assunto_norma_juridica') TipoNormaCrud = Crud.build(TipoNormaJuridica, 'tipo_norma_juridica') NormaCrud = Crud.build(NormaJuridica, '') -NormaTemporarioCrud = Crud.build(NormaJuridica, 'normajuridica') +NormaTemporarioCrud = Crud.build(NormaJuridica, 'norma') LegislacaoCitadaCrud = Crud.build(LegislacaoCitada, '') class NormaPesquisaView(FormView): template_name = "norma/pesquisa.html" - success_url = "normajuridica:norma_pesquisa" + success_url = "norma:norma_pesquisa" form_class = NormaJuridicaPesquisaForm def post(self, request, *args, **kwargs): @@ -113,7 +113,7 @@ class PesquisaNormaListView(ListView): class NormaIncluirView(CreateView): template_name = "norma/normajuridica_incluir.html" form_class = NormaJuridicaForm - success_url = reverse_lazy('normajuridica:list') + success_url = reverse_lazy('norma:list') def form_valid(self, form): norma = form.save(commit=False) @@ -132,7 +132,7 @@ class NormaEditView(UpdateView): template_name = "norma/normajuridica_incluir.html" form_class = NormaJuridicaForm model = NormaJuridica - success_url = reverse_lazy('normajuridica:list') + success_url = reverse_lazy('norma:list') def get_initial(self): data = super(NormaEditView, self).get_initial() diff --git a/templates/comissoes/materias_em_tramitacao.html b/templates/comissoes/materias_em_tramitacao.html index 90fa19418..9efcad892 100644 --- a/templates/comissoes/materias_em_tramitacao.html +++ b/templates/comissoes/materias_em_tramitacao.html @@ -10,7 +10,7 @@ Há {{page_obj|length}} matéria(s) em tramitação nesta unidade.

{% for tramitacao in page_obj %} - + {{tramitacao.materia.tipo.sigla}} {{tramitacao.materia.numero}} {{tramitacao.materia.ano}} - {{tramitacao.materia.tipo}}
{{tramitacao.materia}}
diff --git a/templates/materia/materialegislativa_list.html b/templates/materia/materialegislativa_list.html index 29ea560d9..845656f52 100644 --- a/templates/materia/materialegislativa_list.html +++ b/templates/materia/materialegislativa_list.html @@ -2,11 +2,11 @@ {% load i18n %} {% block more_buttons %} - + {% blocktrans with verbose_name=view.verbose_name %} Formulário Simplificado {% endblocktrans %} - + {% blocktrans with verbose_name=view.verbose_name %} Pesquisar Matéria {% endblocktrans %} {% endblock more_buttons %} diff --git a/templates/materia/pesquisa_materia_list.html b/templates/materia/pesquisa_materia_list.html index 13bd43c2e..83a17712a 100644 --- a/templates/materia/pesquisa_materia_list.html +++ b/templates/materia/pesquisa_materia_list.html @@ -12,7 +12,7 @@ {% for m in materias %} - {{m.tipo.sigla}} {{m.numero}}/{{m.ano}} - {{m.tipo}}
+ {{m.tipo.sigla}} {{m.numero}}/{{m.ano}} - {{m.tipo}}
{{ m.ementa|safe }}
Localização Atual: {{m.tramitacao_set.last.unidade_tramitacao_destino|default_if_none:"Não Informada"}}

From cd13434f60cffb0585b1a9ef55889b67fac94ada Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Thu, 17 Mar 2016 20:36:40 -0300 Subject: [PATCH 07/17] Arruma namespace em varios lugares --- comissoes/views.py | 6 ++--- materia/test_materia_urls.py | 22 +++++++++++++++++++ materia/views.py | 5 +++-- parlamentares/test_parlamentares_urls.py | 7 ++++++ parlamentares/views.py | 6 ++--- templates/base.html | 2 +- templates/comissoes/comissao_list.html | 4 ++-- templates/comissoes/composicao.html | 4 ++-- .../materia/proposicao/proposicao_list.html | 6 ++--- templates/materia/tramitacao.html | 2 +- .../parlamentares/parlamentares_detail.html | 2 +- .../parlamentares/parlamentares_list.html | 2 +- 12 files changed, 49 insertions(+), 19 deletions(-) create mode 100644 materia/test_materia_urls.py create mode 100644 parlamentares/test_parlamentares_urls.py diff --git a/comissoes/views.py b/comissoes/views.py index 0dd5a4812..afc10fe15 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -21,7 +21,7 @@ ComissaoCrud = Crud.build(Comissao, 'modulo_comissoes') class CadastrarComissaoView(CreateView): template_name = "comissoes/cadastrar_comissao.html" form_class = CadastrarComissaoForm - success_url = reverse_lazy('comissao:list') + success_url = reverse_lazy('comissoes') class ComposicaoView(FormView): @@ -124,7 +124,7 @@ class ComissaoParlamentarIncluirView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('comissao:composicao', kwargs={'pk': pk}) + return reverse('comissoes:composicao', kwargs={'pk': pk}) class ComissaoParlamentarEditView(FormView): @@ -166,7 +166,7 @@ class ComissaoParlamentarEditView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('comissao:composicao', kwargs={'pk': pk}) + return reverse('comissoes:composicao', kwargs={'pk': pk}) class MateriasTramitacaoListView(ListView): diff --git a/materia/test_materia_urls.py b/materia/test_materia_urls.py new file mode 100644 index 000000000..9851788bf --- /dev/null +++ b/materia/test_materia_urls.py @@ -0,0 +1,22 @@ +# import pytest +from django.core.urlresolvers import reverse + + +def test_urls_materia(): + st = reverse('materia:pesquisar_materia_list') + assert st == '/materia/pesquisar-materia-list' + + st = reverse('materia:relatoria_edit', kwargs={'pk': '11', 'id': '99'}) + assert st == '/materia/11/relatoria/99/edit' + + st = reverse('materia:tramitacao_edit', kwargs={'pk': '3', 'id': '8'}) + assert st == '/materia/3/tramitacao/8/edit' + + st = reverse('materia:adicionar_proposicao') + assert st == '/materia/proposicao' + + st = reverse('materia:editar_proposicao', kwargs={'pk': '3'}) + assert st == '/materia/proposicao/3/edit' + + st = reverse('materia:list_proposicao') + assert st == '/materia/proposicao_list' diff --git a/materia/views.py b/materia/views.py index df3e31c0a..97272335e 100644 --- a/materia/views.py +++ b/materia/views.py @@ -1259,7 +1259,8 @@ class MateriaLegislativaPesquisaView(FormView): kwargs['situacao'] = form.data['situacao'] request.session['kwargs'] = kwargs - return redirect('pesquisar_materia_list') + + return redirect('materia:pesquisar_materia_list') class PesquisaMateriaListView(ListView): @@ -1325,7 +1326,7 @@ class ProposicaoView(CreateView): form_class = ProposicaoForm def get_success_url(self): - return reverse('list_proposicao') + return reverse('materia:list_proposicao') def get(self, request, *args, **kwargs): return self.render_to_response({'form': self.get_form()}) diff --git a/parlamentares/test_parlamentares_urls.py b/parlamentares/test_parlamentares_urls.py new file mode 100644 index 000000000..634563aa9 --- /dev/null +++ b/parlamentares/test_parlamentares_urls.py @@ -0,0 +1,7 @@ +# import pytest +from django.core.urlresolvers import reverse + + +def test_urls_materia(): + st = reverse('materia:pesquisar_materia_list') + assert st == '/materia/pesquisar-materia-list' diff --git a/parlamentares/views.py b/parlamentares/views.py index deacb89b2..46ccf6128 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -197,7 +197,7 @@ class ParlamentaresEditarView(UpdateView): template_name = "parlamentares/parlamentares_cadastro.html" form_class = ParlamentaresEditForm model = Parlamentar - success_url = reverse_lazy('parlamentares') + success_url = reverse_lazy('parlamentares:parlamentares') def form_valid(self, form): parlamentar = form.instance @@ -344,7 +344,7 @@ class MesaDiretoraView(FormView): id=int(request.POST['cargo'])) composicao.save() - return self.form_valid(form=None) + return redirect('parlamentares:mesa_diretora') elif 'Excluir' in request.POST: @@ -360,7 +360,7 @@ class MesaDiretoraView(FormView): cargo_id=int(ids[1]) ) composicao.delete() - return self.form_valid(form=None) + return redirect('parlamentares:mesa_diretora') else: mesa = ComposicaoMesa.objects.filter( sessao_legislativa=request.POST['sessao']) diff --git a/templates/base.html b/templates/base.html index f629e8bd8..649c63126 100644 --- a/templates/base.html +++ b/templates/base.html @@ -149,7 +149,7 @@ {% block help %} {% if view.help_path %} - {% trans 'Ajuda' %} + {% trans 'Ajuda' %} {% endif %} {% endblock %} diff --git a/templates/comissoes/comissao_list.html b/templates/comissoes/comissao_list.html index a2eefb4ff..b2c5c0197 100644 --- a/templates/comissoes/comissao_list.html +++ b/templates/comissoes/comissao_list.html @@ -4,7 +4,7 @@ {% block base_content %} @@ -22,7 +22,7 @@ {% for comissao in page_obj %} - {{comissao}} + {{comissao}} {{comissao.sigla}} {{comissao.tipo}} diff --git a/templates/comissoes/composicao.html b/templates/comissoes/composicao.html index ffc69a81d..ff6569780 100644 --- a/templates/comissoes/composicao.html +++ b/templates/comissoes/composicao.html @@ -33,7 +33,7 @@ {% for participacao in participacoes %} {% if participacao.composicao_id == composicao_id %} - {{participacao.parlamentar.nome_parlamentar}} + {{participacao.parlamentar.nome_parlamentar}} {{participacao.cargo}} {{participacao.titular|yesno:"Sim,Não"}} {{participacao.data_designacao|date:"d/m/Y"}} @@ -46,7 +46,7 @@ - Incluir Parlamentar + Incluir Parlamentar {% endif %} {% endblock detail_content %} diff --git a/templates/materia/proposicao/proposicao_list.html b/templates/materia/proposicao/proposicao_list.html index d666badbe..7971890ad 100644 --- a/templates/materia/proposicao/proposicao_list.html +++ b/templates/materia/proposicao/proposicao_list.html @@ -8,7 +8,7 @@

Proposições


{% endblock %} @@ -26,9 +26,9 @@ {% for proposicao in page_obj %} {% if proposicao.data_envio %} - {{ proposicao.data_envio|date:'d/m/Y H:i' }} + {{ proposicao.data_envio|date:'d/m/Y H:i' }} {% else %} - Em elaboração... + Em elaboração... {% endif %} {{ proposicao.tipo }} {{ proposicao.descricao|safe }} diff --git a/templates/materia/tramitacao.html b/templates/materia/tramitacao.html index 2576e2342..a879dc5a9 100644 --- a/templates/materia/tramitacao.html +++ b/templates/materia/tramitacao.html @@ -20,7 +20,7 @@ {% for t in tramitacoes %} - {{t.data_tramitacao|date:'d/m/Y'}} + {{t.data_tramitacao|date:'d/m/Y'}} {{t.unidade_tramitacao_local}} {{t.unidade_tramitacao_destino}} {{t.status.descricao}} diff --git a/templates/parlamentares/parlamentares_detail.html b/templates/parlamentares/parlamentares_detail.html index 1cec6e5d7..3eed3c3dd 100644 --- a/templates/parlamentares/parlamentares_detail.html +++ b/templates/parlamentares/parlamentares_detail.html @@ -3,7 +3,7 @@ {% block actions %}
{% if legislatura_id != 0 %} - {% trans 'Incluir Parlamentar' %} + {% trans 'Incluir Parlamentar' %} {% endif %}
{% endblock actions %} diff --git a/templates/parlamentares/parlamentares_list.html b/templates/parlamentares/parlamentares_list.html index ab9f40abf..3d00cce02 100644 --- a/templates/parlamentares/parlamentares_list.html +++ b/templates/parlamentares/parlamentares_list.html @@ -30,7 +30,7 @@ {% for p in parlamentares %} - {{p.nome}} + {{p.nome}} {{p.partido}} {{p.ativo|yesno:"Sim,Não"}} From 3b6479ee1a6c10d61269f0fc2d2230051c976d6a Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Fri, 18 Mar 2016 14:38:34 -0300 Subject: [PATCH 08/17] Soluciona quebras causadas pela mudanca no nome das urls --- comissoes/views.py | 2 +- materia/views.py | 12 +++---- norma/views.py | 4 +-- parlamentares/views.py | 17 ++++++---- protocoloadm/views.py | 31 ++++++++++--------- sessao/forms.py | 26 ++++++++-------- templates/materia/autoria.html | 2 +- templates/materia/despacho_inicial.html | 2 +- templates/materia/documento_acessorio.html | 2 +- templates/materia/materia_anexada.html | 2 +- templates/materia/numeracao.html | 2 +- templates/norma/list_pesquisa.html | 4 +-- templates/painel/index.html | 2 +- .../parlamentares_dependentes.html | 2 +- .../parlamentares/parlamentares_filiacao.html | 2 +- .../parlamentares/parlamentares_mandato.html | 2 +- templates/protocoloadm/detail_doc_detail.html | 6 ++-- .../documento_acessorio_administrativo.html | 2 +- templates/protocoloadm/pesquisa_doc_adm.html | 2 +- .../protocoloadm/proposicoes_detail.html | 8 ++--- .../proposicoes_incorporadas.html | 2 +- .../proposicoes_naoincorporadas.html | 2 +- .../proposicoes_naorecebidas.html | 2 +- templates/protocoloadm/protocolo_list.html | 4 +-- templates/protocoloadm/protocolo_mostrar.html | 4 +-- .../protocoloadm/protocoloadm_detail.html | 8 ++--- templates/protocoloadm/tramitacao.html | 6 ++-- templates/sessao/painel.html | 12 +++---- templates/sessao/pauta_sessao_detail.html | 2 +- templates/sistema.html | 18 +++++------ 30 files changed, 100 insertions(+), 92 deletions(-) diff --git a/comissoes/views.py b/comissoes/views.py index afc10fe15..707cca925 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -21,7 +21,7 @@ ComissaoCrud = Crud.build(Comissao, 'modulo_comissoes') class CadastrarComissaoView(CreateView): template_name = "comissoes/cadastrar_comissao.html" form_class = CadastrarComissaoForm - success_url = reverse_lazy('comissoes') + success_url = reverse_lazy('comissao') class ComposicaoView(FormView): diff --git a/materia/views.py b/materia/views.py index 97272335e..fd1d6e49c 100644 --- a/materia/views.py +++ b/materia/views.py @@ -58,7 +58,7 @@ TramitacaoCrud = Crud.build(Tramitacao, '') class FormularioSimplificadoView(CreateView): template_name = "materia/formulario_simplificado.html" form_class = FormularioSimplificadoForm - success_url = reverse_lazy('materia:materia_list') + success_url = reverse_lazy('materia:materialegislativa_list') class FormularioCadastroView(CreateView): @@ -144,7 +144,7 @@ class MateriaAnexadaView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('materia_anexada', kwargs={'pk': pk}) + return reverse('materia:materia_anexada', kwargs={'pk': pk}) class MateriaAnexadaEditView(FormView): @@ -262,7 +262,7 @@ class DespachoInicialView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('despacho_inicial', kwargs={'pk': pk}) + return reverse('materia:despacho_inicial', kwargs={'pk': pk}) class DespachoInicialEditView(CreateView): @@ -458,7 +458,7 @@ class NumeracaoView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('numeracao', kwargs={'pk': pk}) + return reverse('materia:numeracao', kwargs={'pk': pk}) class NumeracaoEditView(CreateView): @@ -533,7 +533,7 @@ class DocumentoAcessorioView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('documento_acessorio', kwargs={'pk': pk}) + return reverse('materia:documento_acessorio', kwargs={'pk': pk}) class AcompanhamentoConfirmarView(TemplateView): @@ -1361,7 +1361,7 @@ class ProposicaoEditView(CreateView): form_class = ProposicaoForm def get_success_url(self): - return reverse('list_proposicao') + return reverse('materia:list_proposicao') def get(self, request, *args, **kwargs): proposicao = Proposicao.objects.get(id=kwargs['pk']) diff --git a/norma/views.py b/norma/views.py index 3594f38d2..fd06f2a5e 100644 --- a/norma/views.py +++ b/norma/views.py @@ -42,7 +42,7 @@ class NormaPesquisaView(FormView): kwargs['publicacao_final'] = form.data['publicacao_final'] request.session['kwargs'] = kwargs - return redirect('list_pesquisa_norma') + return redirect('norma:list_pesquisa_norma') class PesquisaNormaListView(ListView): @@ -113,7 +113,7 @@ class PesquisaNormaListView(ListView): class NormaIncluirView(CreateView): template_name = "norma/normajuridica_incluir.html" form_class = NormaJuridicaForm - success_url = reverse_lazy('norma:list') + success_url = reverse_lazy('norma') def form_valid(self, form): norma = form.save(commit=False) diff --git a/parlamentares/views.py b/parlamentares/views.py index 46ccf6128..7670a99ba 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -175,7 +175,7 @@ class ParlamentaresCadastroView(CreateView): model = Parlamentar def get_success_url(self): - return reverse('parlamentares') + return reverse('parlamentares:parlamentares') def get_context_data(self, **kwargs): context = super(ParlamentaresCadastroView, self).get_context_data( @@ -223,7 +223,8 @@ class ParlamentaresDependentesView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_dependentes', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_dependentes', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(ParlamentaresDependentesView, self).\ @@ -256,7 +257,8 @@ class ParlamentaresDependentesEditView(UpdateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_dependentes', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_dependentes', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(ParlamentaresDependentesEditView, self).\ @@ -398,7 +400,8 @@ class FiliacaoView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_filiacao', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_filiacao', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(FiliacaoView, self).get_context_data(**kwargs) @@ -432,7 +435,8 @@ class FiliacaoEditView(UpdateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_filiacao', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_filiacao', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(FiliacaoEditView, self).get_context_data(**kwargs) @@ -465,7 +469,8 @@ class MandatoView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_mandato', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_mandato', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(MandatoView, self).get_context_data(**kwargs) diff --git a/protocoloadm/views.py b/protocoloadm/views.py index 6153d9481..4ad417985 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -87,7 +87,7 @@ class ProtocoloPesquisaView(FormView): kwargs['assunto_ementa__icontains'] = request.POST['assunto'] request.session['kwargs'] = kwargs - return redirect('protocolo_list') + return redirect('protocoloadm:protocolo_list') else: return self.form_invalid(form) @@ -118,7 +118,7 @@ class ProtocoloListView(ListView): class AnularProtocoloAdmView(FormView): template_name = 'protocoloadm/anular_protocoloadm.html' form_class = AnularProcoloAdmForm - success_url = reverse_lazy('anular_protocolo') + success_url = reverse_lazy('protocoloadm:anular_protocolo') form_valid_message = _('Protocolo anulado com sucesso!') def get_initial(self): @@ -154,7 +154,7 @@ class ProtocoloDocumentoView(FormValidMessageMixin, FormView): template_name = "protocoloadm/protocolar_documento.html" form_class = ProtocoloDocumentForm - success_url = reverse_lazy('protocolo') + success_url = reverse_lazy('protocoloadm:protocolo') form_valid_message = _('Protocolo cadastrado com sucesso!') def post(self, request, *args, **kwargs): @@ -209,8 +209,9 @@ class CriarDocumentoProtocolo(CreateView): return self.criar_documento(protocolo) def get_success_url(self): - return reverse('protocolo_mostrar', kwargs={'pk': self.kwargs['pk'], - 'ano': self.kwargs['ano']}) + return reverse('protocoloadm:protocolo_mostrar', + kwargs={'pk': self.kwargs['pk'], + 'ano': self.kwargs['ano']}) def criar_documento(self, protocolo): @@ -281,9 +282,10 @@ class ProtocoloMateriaView(FormView): form_valid_message = _('Matéria cadastrada com sucesso!') def get_success_url(self): - return reverse('protocolo') + return reverse('protocoloadm:protocolo') def post(self, request, *args, **kwargs): + # import ipdb; ipdb.set_trace() form = ProtocoloMateriaForm(request.POST) @@ -306,7 +308,8 @@ class ProtocoloMateriaView(FormView): protocolo.timestamp = datetime.now().strftime("%Y-%m-%d %H:%M") protocolo.tipo_protocolo = request.POST['tipo_protocolo'] protocolo.tipo_processo = '0' # TODO validar o significado - protocolo.autor = Autor.objects.get(id=request.POST['autor']) + if request.POST['autor'] != '': + protocolo.autor = Autor.objects.get(id=request.POST['autor']) protocolo.anulado = False protocolo.tipo_materia = TipoMateriaLegislativa.objects.get( id=request.POST['tipo_materia']) @@ -479,10 +482,10 @@ class DetailDocumentoAdministrativo(DetailView): return HttpResponseRedirect(self.get_success_url()) def get_success_delete(self): - return reverse('pesq_doc_adm') + return reverse('protocoloadm:pesq_doc_adm') def get_success_url(self): - return reverse('detail_doc_adm', kwargs={ + return reverse('protocoloadm:detail_doc_adm', kwargs={ 'pk': self.kwargs['pk']}) @@ -530,7 +533,7 @@ class DocumentoAcessorioAdministrativoEditView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('doc_ace_adm', kwargs={'pk': pk}) + return reverse('protocoloadm:doc_ace_adm', kwargs={'pk': pk}) class DocumentoAcessorioAdministrativoView(FormView): @@ -569,7 +572,7 @@ class DocumentoAcessorioAdministrativoView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('doc_ace_adm', kwargs={'pk': pk}) + return reverse('protocoloadm:doc_ace_adm', kwargs={'pk': pk}) class TramitacaoAdmView(FormView): @@ -605,8 +608,7 @@ class TramitacaoAdmIncluirView(FormView): tramitacao = form.save(commit=False) tramitacao.ultima = False tramitacao.save() - return HttpResponseRedirect( - reverse('tramitacao', kwargs={'pk': pk})) + return reverse('protocoloadm:tramitacao', kwargs={'pk': pk}) else: return self.form_invalid(form) @@ -633,7 +635,8 @@ class TramitacaoAdmEditView(FormView): tramitacao.ultima = False tramitacao.save() return HttpResponseRedirect( - reverse('tramitacao', kwargs={'pk': tramitacao.documento.id})) + reverse('protocoloadm:tramitacao', + kwargs={'pk': tramitacao.documento.id})) else: return self.form_invalid(form) diff --git a/sessao/forms.py b/sessao/forms.py index 0f44294d9..f8b526f2d 100644 --- a/sessao/forms.py +++ b/sessao/forms.py @@ -93,19 +93,19 @@ class SessaoForm(ModelForm): 'hora_fim': forms.TextInput(attrs={'class': 'hora'}), } - def clean_url_audio(self): - url_audio = self.cleaned_data.get('url_audio', False) - if url_audio: - if url_audio.size > 5*1024*1024: - raise ValidationError("Arquivo muito grande. ( > 5mb )") - return url_audio - - def clean_url_video(self): - url_video = self.cleaned_data.get('url_video', False) - if url_video: - if url_video.size > 5*1024*1024: - raise ValidationError("Arquivo muito grande. ( > 5mb )") - return url_video + # def clean_url_audio(self): + # url_audio = self.cleaned_data.get('url_audio', False) + # if url_audio: + # if url_audio.size > 5*1024*1024: + # raise ValidationError("Arquivo muito grande. ( > 5mb )") + # return url_audio + + # def clean_url_video(self): + # url_video = self.cleaned_data.get('url_video', False) + # if url_video: + # if url_video.size > 5*1024*1024: + # raise ValidationError("Arquivo muito grande. ( > 5mb )") + # return url_video def __init__(self, *args, **kwargs): diff --git a/templates/materia/autoria.html b/templates/materia/autoria.html index d90febf81..d1e79e695 100644 --- a/templates/materia/autoria.html +++ b/templates/materia/autoria.html @@ -20,7 +20,7 @@ {% for a in autorias %} - {{a.autor}} + {{a.autor}} {{a.autor.tipo.descricao}} {{a.primeiro_autor|yesno:"Sim,Não"}} {{a.partido.sigla|default_if_none:"Não Informado"}} diff --git a/templates/materia/despacho_inicial.html b/templates/materia/despacho_inicial.html index 9c1a103d9..908bb09dd 100644 --- a/templates/materia/despacho_inicial.html +++ b/templates/materia/despacho_inicial.html @@ -18,7 +18,7 @@ {% for d in despachos %} - {{d.comissao.nome}} + {{d.comissao.nome}} {{d.comissao.sigla}} {% endfor %} diff --git a/templates/materia/documento_acessorio.html b/templates/materia/documento_acessorio.html index a4db6f7d3..438cfb118 100644 --- a/templates/materia/documento_acessorio.html +++ b/templates/materia/documento_acessorio.html @@ -20,7 +20,7 @@ {% for d in docs %} - {{d.nome}} + {{d.nome}} {{d.tipo.descricao}} {{d.data|date:'d/m/Y'}} {{d.autor}} diff --git a/templates/materia/materia_anexada.html b/templates/materia/materia_anexada.html index 2fe6e3fa2..7eb6b20c6 100644 --- a/templates/materia/materia_anexada.html +++ b/templates/materia/materia_anexada.html @@ -20,7 +20,7 @@ {% for a in anexadas %} - {{a.materia_anexada.tipo.sigla}} {{a.materia_anexada.numero}}/{{a.materia_anexada.ano}} + {{a.materia_anexada.tipo.sigla}} {{a.materia_anexada.numero}}/{{a.materia_anexada.ano}} {{a.data_anexacao|date:"d/m/Y"}} {{a.data_desanexacao|date:"d/m/Y"}} diff --git a/templates/materia/numeracao.html b/templates/materia/numeracao.html index b98e28a1b..1956a4fd4 100644 --- a/templates/materia/numeracao.html +++ b/templates/materia/numeracao.html @@ -21,7 +21,7 @@ {% for n in numeracao %} - {{n.tipo_materia.sigla}} + {{n.tipo_materia.sigla}} {{n.tipo_materia.descricao}} {{n.numero_materia}} {{n.ano_materia}} diff --git a/templates/norma/list_pesquisa.html b/templates/norma/list_pesquisa.html index e4a1bb020..fe46141fe 100644 --- a/templates/norma/list_pesquisa.html +++ b/templates/norma/list_pesquisa.html @@ -4,7 +4,7 @@ {% block actions %}{% endblock %} {% block detail_content %}


{% if object_list %} @@ -20,7 +20,7 @@ {% for obj in object_list %} - {{obj.tipo}} + {{obj.tipo}} {{obj.numero}} {{obj.ano}} {{obj.data}} diff --git a/templates/painel/index.html b/templates/painel/index.html index 4460ce721..a82dc109f 100644 --- a/templates/painel/index.html +++ b/templates/painel/index.html @@ -168,7 +168,7 @@

- +





diff --git a/templates/parlamentares/parlamentares_dependentes.html b/templates/parlamentares/parlamentares_dependentes.html index 00c185658..aa790f8e0 100644 --- a/templates/parlamentares/parlamentares_dependentes.html +++ b/templates/parlamentares/parlamentares_dependentes.html @@ -19,7 +19,7 @@ {% for d in dependentes %} - {{d.nome}} + {{d.nome}} {{d.tipo }} {{d.data_nascimento|default_if_none:""}} diff --git a/templates/parlamentares/parlamentares_filiacao.html b/templates/parlamentares/parlamentares_filiacao.html index 789d3a0c7..0013946df 100644 --- a/templates/parlamentares/parlamentares_filiacao.html +++ b/templates/parlamentares/parlamentares_filiacao.html @@ -19,7 +19,7 @@ {% for f in filiacoes %} - {{f.partido.sigla}} + {{f.partido.sigla}} {{f.data}} {{f.data_desfiliacao|default_if_none:""}} diff --git a/templates/parlamentares/parlamentares_mandato.html b/templates/parlamentares/parlamentares_mandato.html index b676c47f8..4cdca75d0 100644 --- a/templates/parlamentares/parlamentares_mandato.html +++ b/templates/parlamentares/parlamentares_mandato.html @@ -22,7 +22,7 @@ {% for m in mandatos %} - {{m.legislatura}} + {{m.legislatura}} {{m.coligacao|default_if_none:""}} {{m.data_fim_mandato|default_if_none:""}} {{m.data_expedicao_diploma|default_if_none:""}} diff --git a/templates/protocoloadm/detail_doc_detail.html b/templates/protocoloadm/detail_doc_detail.html index daa96a778..22e093d95 100644 --- a/templates/protocoloadm/detail_doc_detail.html +++ b/templates/protocoloadm/detail_doc_detail.html @@ -3,8 +3,8 @@ {% block actions %} {% endblock %} {% block sections_nav %} {% endblock sections_nav %} diff --git a/templates/protocoloadm/documento_acessorio_administrativo.html b/templates/protocoloadm/documento_acessorio_administrativo.html index 2b1f9010e..8e02768e1 100644 --- a/templates/protocoloadm/documento_acessorio_administrativo.html +++ b/templates/protocoloadm/documento_acessorio_administrativo.html @@ -26,7 +26,7 @@ {% for d in doc_ace %} {{d.arquivo}} - {{d.nome}} + {{d.nome}} {{d.tipo.descricao}} {{d.data|date:"d/m/Y"}} {{d.autor}} diff --git a/templates/protocoloadm/pesquisa_doc_adm.html b/templates/protocoloadm/pesquisa_doc_adm.html index 81c0428dd..27217ab58 100644 --- a/templates/protocoloadm/pesquisa_doc_adm.html +++ b/templates/protocoloadm/pesquisa_doc_adm.html @@ -12,7 +12,7 @@ {% for d in documentos %} - {{ d.tipo.sigla }} {{ d.numero }}/{{ d.ano }} - {{ d.tipo }}
+ {{ d.tipo.sigla }} {{ d.numero }}/{{ d.ano }} - {{ d.tipo }}
{{ d.assunto }}
Interessado: {{ d.interessado }} diff --git a/templates/protocoloadm/proposicoes_detail.html b/templates/protocoloadm/proposicoes_detail.html index f0b3b2eab..1a24c467e 100644 --- a/templates/protocoloadm/proposicoes_detail.html +++ b/templates/protocoloadm/proposicoes_detail.html @@ -3,9 +3,9 @@ {% block sections_nav %} {% endblock sections_nav %} diff --git a/templates/protocoloadm/proposicoes_incorporadas.html b/templates/protocoloadm/proposicoes_incorporadas.html index 6c73e9ae5..4b60f1842 100644 --- a/templates/protocoloadm/proposicoes_incorporadas.html +++ b/templates/protocoloadm/proposicoes_incorporadas.html @@ -8,7 +8,7 @@ {% for p in object_list %} - + {{ p.data_envio|date:"d/m/Y" }} diff --git a/templates/protocoloadm/proposicoes_naoincorporadas.html b/templates/protocoloadm/proposicoes_naoincorporadas.html index 9fab2011c..44c561f2c 100644 --- a/templates/protocoloadm/proposicoes_naoincorporadas.html +++ b/templates/protocoloadm/proposicoes_naoincorporadas.html @@ -8,7 +8,7 @@ {% for p in object_list %} - + {{ p.data_envio|date:"d/m/Y" }} diff --git a/templates/protocoloadm/proposicoes_naorecebidas.html b/templates/protocoloadm/proposicoes_naorecebidas.html index ecf2690ca..1a2663b9c 100644 --- a/templates/protocoloadm/proposicoes_naorecebidas.html +++ b/templates/protocoloadm/proposicoes_naorecebidas.html @@ -8,7 +8,7 @@ {% for p in object_list %} - + {{ p.data_envio|date:"d/m/Y" }} diff --git a/templates/protocoloadm/protocolo_list.html b/templates/protocoloadm/protocolo_list.html index 0957bcdf9..fa1ae6a02 100644 --- a/templates/protocoloadm/protocolo_list.html +++ b/templates/protocoloadm/protocolo_list.html @@ -12,11 +12,11 @@ Protocolo: - + {{ p.numero|stringformat:'06d' }}/{{ p.ano }}   -   - + Etiqueta Individual
Assunto: {{ p.assunto_ementa }}
diff --git a/templates/protocoloadm/protocolo_mostrar.html b/templates/protocoloadm/protocolo_mostrar.html index 4a01bfc7e..00a4e7d2d 100644 --- a/templates/protocoloadm/protocolo_mostrar.html +++ b/templates/protocoloadm/protocolo_mostrar.html @@ -16,8 +16,8 @@
Documento Vinculado:
- Criar Documento + Criar Documento      - Comprovante + Comprovante {% endblock detail_content %} \ No newline at end of file diff --git a/templates/protocoloadm/protocoloadm_detail.html b/templates/protocoloadm/protocoloadm_detail.html index ea65da477..c95e4ed75 100644 --- a/templates/protocoloadm/protocoloadm_detail.html +++ b/templates/protocoloadm/protocoloadm_detail.html @@ -3,9 +3,9 @@ {% block actions %}{% endblock %} {% block sections_nav %} {% endblock sections_nav %} diff --git a/templates/protocoloadm/tramitacao.html b/templates/protocoloadm/tramitacao.html index 1acd75f64..121ea5b54 100644 --- a/templates/protocoloadm/tramitacao.html +++ b/templates/protocoloadm/tramitacao.html @@ -22,11 +22,11 @@ {% for t in tramitacoes %} - {{t.data_encaminhamento|date:"d/m/Y"}} + {{t.data_encaminhamento|date:"d/m/Y"}} {{t.unidade_tramitacao_local}} {{t.unidade_tramitacao_destino}} {{t.status.sigla}} - Excluir + Excluir {% endfor %} @@ -35,6 +35,6 @@ Nenhuma tramitação cadastrada para este documento. {% endif %}
-
Incluir Tramitação + Incluir Tramitação {% endblock detail_content %} \ No newline at end of file diff --git a/templates/sessao/painel.html b/templates/sessao/painel.html index cb62f6cd0..9bed5e5cb 100644 --- a/templates/sessao/painel.html +++ b/templates/sessao/painel.html @@ -6,12 +6,12 @@

Operação do Painel Eletrônico

diff --git a/templates/sessao/pauta_sessao_detail.html b/templates/sessao/pauta_sessao_detail.html index 4a26e389b..0a7208ffa 100644 --- a/templates/sessao/pauta_sessao_detail.html +++ b/templates/sessao/pauta_sessao_detail.html @@ -5,7 +5,7 @@ {% block detail_content %}
- +
Pauta da Sessão
{{ sessaoplenaria }}
diff --git a/templates/sistema.html b/templates/sistema.html index 1a083ec5d..1d8d2e107 100644 --- a/templates/sistema.html +++ b/templates/sistema.html @@ -5,23 +5,23 @@

Configuração Inicial

Módulo Parlamentares

Módulo Mesa Diretora

From 1229f76e104b8be048c1fa1924fe443d9773addc Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Fri, 18 Mar 2016 15:13:58 -0300 Subject: [PATCH 09/17] =?UTF-8?q?Corrige=20outras=20URLs=20que=20estavam?= =?UTF-8?q?=20quebrando=20por=20causa=20da=20mudan=C3=A7a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comissoes/views.py | 2 +- templates/sistema.html | 44 +++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/comissoes/views.py b/comissoes/views.py index 707cca925..5eefa208f 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -21,7 +21,7 @@ ComissaoCrud = Crud.build(Comissao, 'modulo_comissoes') class CadastrarComissaoView(CreateView): template_name = "comissoes/cadastrar_comissao.html" form_class = CadastrarComissaoForm - success_url = reverse_lazy('comissao') + success_url = reverse_lazy('comissoes:comissao_list') class ComposicaoView(FormView): diff --git a/templates/sistema.html b/templates/sistema.html index 1d8d2e107..0ef599fc6 100644 --- a/templates/sistema.html +++ b/templates/sistema.html @@ -21,15 +21,15 @@

Módulo Mesa Diretora

Módulo Comissões

Módulo Bancadas

@@ -40,22 +40,22 @@

Módulo Proposições

Módulo Matéria Legislativa

Módulo Normas Jurídicas

@@ -66,17 +66,17 @@

Módulo Sessão Plenária

Módulo LexML

Módulo Administrativo

From 064bb486301e7aa13bcf2a525c514fd35d6ed718 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Mon, 21 Mar 2016 12:48:21 -0300 Subject: [PATCH 10/17] Finaliza correcao de URL's --- norma/views.py | 3 ++- protocoloadm/models.py | 2 +- protocoloadm/views.py | 6 ++++-- sessao/forms.py | 1 - templates/comissoes/subnav.yaml | 4 ++-- templates/sistema.html | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/norma/views.py b/norma/views.py index fd06f2a5e..5164431dc 100644 --- a/norma/views.py +++ b/norma/views.py @@ -113,11 +113,12 @@ class PesquisaNormaListView(ListView): class NormaIncluirView(CreateView): template_name = "norma/normajuridica_incluir.html" form_class = NormaJuridicaForm - success_url = reverse_lazy('norma') + success_url = reverse_lazy('norma:normajuridica_list') def form_valid(self, form): norma = form.save(commit=False) norma.timestamp = datetime.now() + # import ipdb; ipdb.set_trace() if form.cleaned_data['tipo_materia']: materia = MateriaLegislativa.objects.get( tipo_id=form.data['tipo_materia'], diff --git a/protocoloadm/models.py b/protocoloadm/models.py index bd58a9933..514480eb0 100644 --- a/protocoloadm/models.py +++ b/protocoloadm/models.py @@ -175,7 +175,7 @@ class TramitacaoAdministrativo(models.Model): null=True, related_name='+', verbose_name=_('Unidade Destino')) - ultima = models.BooleanField() + ultima = models.NullBooleanField(verbose_name=_('Ultima')) texto = models.TextField( blank=True, verbose_name=_('Texto da Ação')) data_fim_prazo = models.DateField( diff --git a/protocoloadm/views.py b/protocoloadm/views.py index 4ad417985..a2dbf28b7 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -605,10 +605,12 @@ class TramitacaoAdmIncluirView(FormView): form = TramitacaoAdmForm(request.POST or None) if form.is_valid(): + # import ipdb; ipdb.set_trace() tramitacao = form.save(commit=False) tramitacao.ultima = False tramitacao.save() - return reverse('protocoloadm:tramitacao', kwargs={'pk': pk}) + return HttpResponseRedirect(reverse( + 'protocoloadm:tramitacao_adm', kwargs={'pk': pk})) else: return self.form_invalid(form) @@ -635,7 +637,7 @@ class TramitacaoAdmEditView(FormView): tramitacao.ultima = False tramitacao.save() return HttpResponseRedirect( - reverse('protocoloadm:tramitacao', + reverse('protocoloadm:tramitacao_adm', kwargs={'pk': tramitacao.documento.id})) else: return self.form_invalid(form) diff --git a/sessao/forms.py b/sessao/forms.py index f8b526f2d..0636dfc07 100644 --- a/sessao/forms.py +++ b/sessao/forms.py @@ -1,7 +1,6 @@ from crispy_forms.helper import FormHelper from crispy_forms.layout import Fieldset, Layout from django import forms -from django.core.exceptions import ValidationError from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ diff --git a/templates/comissoes/subnav.yaml b/templates/comissoes/subnav.yaml index 7ac544f9c..97526cb9e 100644 --- a/templates/comissoes/subnav.yaml +++ b/templates/comissoes/subnav.yaml @@ -1,6 +1,6 @@ - title: Início url: comissao_detail - title: Composição - url: comissao_composicao + url: composicao - title: Matérias em Tramitação - url: comissao_materias_em_tramitacao + url: materias_em_tramitacao diff --git a/templates/sistema.html b/templates/sistema.html index 0ef599fc6..d65223ba0 100644 --- a/templates/sistema.html +++ b/templates/sistema.html @@ -66,7 +66,7 @@

Módulo Sessão Plenária

- + From 5567e7ca1726798a9fa55c83d62f458ccede1e31 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Wed, 30 Mar 2016 11:35:18 -0300 Subject: [PATCH 11/17] =?UTF-8?q?Reverte=20altera=C3=A7=C3=A3o=20n=C3=A3o?= =?UTF-8?q?=20prevista=20em=20model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocoloadm/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocoloadm/models.py b/protocoloadm/models.py index 514480eb0..bd58a9933 100644 --- a/protocoloadm/models.py +++ b/protocoloadm/models.py @@ -175,7 +175,7 @@ class TramitacaoAdministrativo(models.Model): null=True, related_name='+', verbose_name=_('Unidade Destino')) - ultima = models.NullBooleanField(verbose_name=_('Ultima')) + ultima = models.BooleanField() texto = models.TextField( blank=True, verbose_name=_('Texto da Ação')) data_fim_prazo = models.DateField( From 0d9295be5795232255f94243166d4842c7bba3b9 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Wed, 30 Mar 2016 11:35:36 -0300 Subject: [PATCH 12/17] =?UTF-8?q?Remove=20c=C3=B3digo=20comentado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- materia/test_materia_urls.py | 1 - norma/views.py | 13 ++++++------- parlamentares/test_parlamentares_urls.py | 1 - protocoloadm/views.py | 6 ++---- sessao/forms.py | 14 -------------- 5 files changed, 8 insertions(+), 27 deletions(-) diff --git a/materia/test_materia_urls.py b/materia/test_materia_urls.py index 9851788bf..a2c41d996 100644 --- a/materia/test_materia_urls.py +++ b/materia/test_materia_urls.py @@ -1,4 +1,3 @@ -# import pytest from django.core.urlresolvers import reverse diff --git a/norma/views.py b/norma/views.py index 5164431dc..181e4df1e 100644 --- a/norma/views.py +++ b/norma/views.py @@ -118,12 +118,11 @@ class NormaIncluirView(CreateView): def form_valid(self, form): norma = form.save(commit=False) norma.timestamp = datetime.now() - # import ipdb; ipdb.set_trace() if form.cleaned_data['tipo_materia']: materia = MateriaLegislativa.objects.get( - tipo_id=form.data['tipo_materia'], - numero=form.data['numero_materia'], - ano=form.data['ano_materia']) + tipo_id=form.data['tipo_materia'], + numero=form.data['numero_materia'], + ano=form.data['ano_materia']) norma.materia = materia norma.save() return HttpResponseRedirect(self.get_success_url()) @@ -151,9 +150,9 @@ class NormaEditView(UpdateView): norma.timestamp = datetime.now() if form.cleaned_data['tipo_materia']: materia = MateriaLegislativa.objects.get( - tipo_id=form.data['tipo_materia'], - numero=form.data['numero_materia'], - ano=form.data['ano_materia']) + tipo_id=form.data['tipo_materia'], + numero=form.data['numero_materia'], + ano=form.data['ano_materia']) norma.materia = materia norma.save() return HttpResponseRedirect(self.get_success_url()) diff --git a/parlamentares/test_parlamentares_urls.py b/parlamentares/test_parlamentares_urls.py index 634563aa9..c72c8c0be 100644 --- a/parlamentares/test_parlamentares_urls.py +++ b/parlamentares/test_parlamentares_urls.py @@ -1,4 +1,3 @@ -# import pytest from django.core.urlresolvers import reverse diff --git a/protocoloadm/views.py b/protocoloadm/views.py index a2dbf28b7..0ed6f0728 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -285,7 +285,6 @@ class ProtocoloMateriaView(FormView): return reverse('protocoloadm:protocolo') def post(self, request, *args, **kwargs): - # import ipdb; ipdb.set_trace() form = ProtocoloMateriaForm(request.POST) @@ -605,12 +604,11 @@ class TramitacaoAdmIncluirView(FormView): form = TramitacaoAdmForm(request.POST or None) if form.is_valid(): - # import ipdb; ipdb.set_trace() tramitacao = form.save(commit=False) tramitacao.ultima = False tramitacao.save() return HttpResponseRedirect(reverse( - 'protocoloadm:tramitacao_adm', kwargs={'pk': pk})) + 'protocoloadm:tramitacao_adm', kwargs={'pk': pk})) else: return self.form_invalid(form) @@ -671,7 +669,7 @@ def pesquisa_autores(request): Q(nome__icontains=q) | Q(parlamentar__nome_parlamentar__icontains=q) | Q(comissao__nome__icontains=q) - ) + ) autores = [] diff --git a/sessao/forms.py b/sessao/forms.py index 0636dfc07..4b2367e52 100644 --- a/sessao/forms.py +++ b/sessao/forms.py @@ -92,20 +92,6 @@ class SessaoForm(ModelForm): 'hora_fim': forms.TextInput(attrs={'class': 'hora'}), } - # def clean_url_audio(self): - # url_audio = self.cleaned_data.get('url_audio', False) - # if url_audio: - # if url_audio.size > 5*1024*1024: - # raise ValidationError("Arquivo muito grande. ( > 5mb )") - # return url_audio - - # def clean_url_video(self): - # url_video = self.cleaned_data.get('url_video', False) - # if url_video: - # if url_video.size > 5*1024*1024: - # raise ValidationError("Arquivo muito grande. ( > 5mb )") - # return url_video - def __init__(self, *args, **kwargs): row1 = crispy_layout_mixin.to_row( From 2342ee3beb2bcd3bffda3ee46c84fe5d5f8b8f76 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Mon, 4 Apr 2016 12:27:17 -0300 Subject: [PATCH 13/17] Termina de arrumar o namespace das urls. Adiciona .orig no git ignore. Deixa o teste de materia mais sucinto --- .gitignore | 4 +++ base/views.py | 2 +- materia/test_materia.py | 4 +-- materia/test_materia_urls.py | 37 ++++++++++++----------- materia/views.py | 4 +-- norma/test_norma.py | 4 +-- parlamentares/views.py | 2 +- templates/materia/legislacao_citada.html | 2 +- templates/materia/relatoria.html | 2 +- templates/norma/normajuridica_detail.html | 6 ++-- templates/norma/normajuridica_list.html | 4 +-- templates/painel/mensagem.html | 2 +- templates/painel/parlamentares.html | 2 +- templates/painel/votacao.html | 2 +- templates/sessao/pauta/expediente.html | 2 +- templates/sessao/pauta/ordem.html | 2 +- 16 files changed, 43 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 65fefe18f..57b491858 100644 --- a/.gitignore +++ b/.gitignore @@ -88,3 +88,7 @@ collected_static bower bower_components media + +# Merge garbage +.orig + diff --git a/base/views.py b/base/views.py index f5650d0b5..1950ce99a 100644 --- a/base/views.py +++ b/base/views.py @@ -64,4 +64,4 @@ class CasaLegislativaTableAuxView(FormView): return self.render_to_response({'form': form}) def get_success_url(self): - return reverse('casa_legislativa') + return reverse('base:casa_legislativa') diff --git a/materia/test_materia.py b/materia/test_materia.py index 99b78b6c2..d628856bb 100644 --- a/materia/test_materia.py +++ b/materia/test_materia.py @@ -422,7 +422,7 @@ def test_form_errors_relatoria(client): @pytest.mark.django_db(transaction=False) def test_proposicao_submit(client): - response = client.post(reverse('adicionar_proposicao'), + response = client.post(reverse('materia:adicionar_proposicao'), {'tipo': mommy.make(TipoProposicao, pk=3).pk, 'descricao': 'Teste proposição', 'salvar': 'salvar'}, @@ -438,7 +438,7 @@ def test_proposicao_submit(client): @pytest.mark.django_db(transaction=False) def test_form_errors_proposicao(client): - response = client.post(reverse('adicionar_proposicao'), + response = client.post(reverse('materia:adicionar_proposicao'), {'salvar': 'salvar'}, follow=True) diff --git a/materia/test_materia_urls.py b/materia/test_materia_urls.py index a2c41d996..caad5f965 100644 --- a/materia/test_materia_urls.py +++ b/materia/test_materia_urls.py @@ -1,21 +1,22 @@ from django.core.urlresolvers import reverse +import pytest -def test_urls_materia(): - st = reverse('materia:pesquisar_materia_list') - assert st == '/materia/pesquisar-materia-list' - - st = reverse('materia:relatoria_edit', kwargs={'pk': '11', 'id': '99'}) - assert st == '/materia/11/relatoria/99/edit' - - st = reverse('materia:tramitacao_edit', kwargs={'pk': '3', 'id': '8'}) - assert st == '/materia/3/tramitacao/8/edit' - - st = reverse('materia:adicionar_proposicao') - assert st == '/materia/proposicao' - - st = reverse('materia:editar_proposicao', kwargs={'pk': '3'}) - assert st == '/materia/proposicao/3/edit' - - st = reverse('materia:list_proposicao') - assert st == '/materia/proposicao_list' +@pytest.mark.parametrize("test_input,kwargs,expected", [ + ('materia:pesquisar_materia_list', + {}, + '/materia/pesquisar-materia-list'), + ('materia:relatoria_edit', + {'pk': '11', 'id': '99'}, + '/materia/11/relatoria/99/edit'), + ('materia:tramitacao_edit', + {'pk': '3', 'id': '8'}, + '/materia/3/tramitacao/8/edit'), + ('materia:adicionar_proposicao', {}, '/materia/proposicao'), + ('materia:editar_proposicao', + {'pk': '3'}, + '/materia/proposicao/3/edit'), + ('materia:list_proposicao', {}, '/materia/proposicao_list'), +]) +def test_reverse(test_input, kwargs, expected): + assert reverse(test_input, kwargs=kwargs) == expected diff --git a/materia/views.py b/materia/views.py index 794aadb5c..35957c0c2 100644 --- a/materia/views.py +++ b/materia/views.py @@ -64,7 +64,7 @@ class FormularioSimplificadoView(CreateView): class FormularioCadastroView(CreateView): template_name = "materia/formulario_cadastro.html" form_class = FormularioCadastroForm - success_url = reverse_lazy('formulario_cadastro') + success_url = reverse_lazy('materia:formulario_cadastro') class MateriaAnexadaView(FormView): @@ -1191,7 +1191,7 @@ class MateriaLegislativaPesquisaView(FormView): template_name = 'materia/pesquisa_materia.html' def get_success_url(self): - return reverse('pesquisar_materia') + return reverse('materia:pesquisar_materia') def get(self, request, *args, **kwargs): form = MateriaLegislativaPesquisaForm() diff --git a/norma/test_norma.py b/norma/test_norma.py index 3743a7159..4731995b2 100644 --- a/norma/test_norma.py +++ b/norma/test_norma.py @@ -13,7 +13,7 @@ def test_incluir_norma_submit(client): descricao='Teste') # Testa POST - response = client.post(reverse('norma_incluir'), + response = client.post(reverse('norma:norma_incluir'), {'tipo': tipo.pk, 'numero': '1', 'ano': '2016', @@ -33,7 +33,7 @@ def test_incluir_norma_submit(client): @pytest.mark.django_db(transaction=False) def test_incluir_norma_errors(client): - response = client.post(reverse('norma_incluir'), + response = client.post(reverse('norma:norma_incluir'), {'salvar': 'salvar'}, follow=True) diff --git a/parlamentares/views.py b/parlamentares/views.py index 7f171fd2d..4bf61e41d 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -286,7 +286,7 @@ class ParlamentaresDependentesEditView(UpdateView): class MesaDiretoraView(FormView): template_name = "mesa_diretora/mesa_diretora.html" - success_url = reverse_lazy('mesa_diretora') + success_url = reverse_lazy('parlamentares:mesa_diretora') # Essa função avisa quando se pode compor uma Mesa Legislativa) def validation(self, request): diff --git a/templates/materia/legislacao_citada.html b/templates/materia/legislacao_citada.html index 8dc2ff49d..9ed99f31f 100644 --- a/templates/materia/legislacao_citada.html +++ b/templates/materia/legislacao_citada.html @@ -20,7 +20,7 @@ {% for l in legislacao %} - {{l.norma.tipo.descricao}} + {{l.norma.tipo.descricao}} {{l.norma.numero}} {{l.norma.ano}} {{l.disposicoes}} diff --git a/templates/materia/relatoria.html b/templates/materia/relatoria.html index 66397c10d..778b5f355 100644 --- a/templates/materia/relatoria.html +++ b/templates/materia/relatoria.html @@ -19,7 +19,7 @@ {% for r in relatorias %} - {{r.data_designacao_relator|date:'d/m/Y'}} + {{r.data_designacao_relator|date:'d/m/Y'}} {{r.comissao}} {{r.parlamentar}} diff --git a/templates/norma/normajuridica_detail.html b/templates/norma/normajuridica_detail.html index 7487ff7cc..13ec219d4 100644 --- a/templates/norma/normajuridica_detail.html +++ b/templates/norma/normajuridica_detail.html @@ -4,7 +4,7 @@ {% endblock sections_nav %} @@ -21,7 +21,7 @@
{% block actions %} {% endblock actions %} diff --git a/templates/norma/normajuridica_list.html b/templates/norma/normajuridica_list.html index 6d5431bd5..f39f02bf0 100644 --- a/templates/norma/normajuridica_list.html +++ b/templates/norma/normajuridica_list.html @@ -3,7 +3,7 @@ {% load crispy_forms_tags %} {% block base_content %} @@ -21,7 +21,7 @@ {% for obj in object_list %} - {{obj.tipo}} + {{obj.tipo}} {{obj.numero}} {{obj.ano}} {{obj.data}} diff --git a/templates/painel/mensagem.html b/templates/painel/mensagem.html index 607c30fe4..65071a796 100644 --- a/templates/painel/mensagem.html +++ b/templates/painel/mensagem.html @@ -94,7 +94,7 @@

{{ context.title }}

- +

Ajax refresh counter:



diff --git a/templates/painel/parlamentares.html b/templates/painel/parlamentares.html index a9ffd8072..b31e9b1f4 100644 --- a/templates/painel/parlamentares.html +++ b/templates/painel/parlamentares.html @@ -95,7 +95,7 @@

{{ context.title }}

- +





diff --git a/templates/painel/votacao.html b/templates/painel/votacao.html index fa235b8a2..ea77c1727 100644 --- a/templates/painel/votacao.html +++ b/templates/painel/votacao.html @@ -94,7 +94,7 @@

{{ context.title }}

- +





diff --git a/templates/sessao/pauta/expediente.html b/templates/sessao/pauta/expediente.html index 3430b4e3b..75f49af63 100644 --- a/templates/sessao/pauta/expediente.html +++ b/templates/sessao/pauta/expediente.html @@ -38,7 +38,7 @@



- Tramitação{% if expediente.materia.em_tramitacao %} >>> Acompanhar matéria <<<{% endif %} + Tramitação{% if expediente.materia.em_tramitacao %} >>> Acompanhar matéria <<<{% endif %} {% for t in tramitacao %} Data: {{t.data_tramitacao}}
diff --git a/templates/sessao/pauta/ordem.html b/templates/sessao/pauta/ordem.html index 861ca49e3..a57ee2150 100644 --- a/templates/sessao/pauta/ordem.html +++ b/templates/sessao/pauta/ordem.html @@ -46,7 +46,7 @@


- Tramitação{% if ordem.materia.em_tramitacao %} >>> Acompanhar matéria <<<{% endif %} + Tramitação{% if ordem.materia.em_tramitacao %} >>> Acompanhar matéria <<<{% endif %} {% for t in tramitacao %} Data: {{t.data_tramitacao}}
From 085af96987b69bd3c462a568541e0a810bbb5026 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Mon, 4 Apr 2016 13:09:42 -0300 Subject: [PATCH 14/17] Deixa o teste de urls de materia mais sucinto --- materia/test_materia_urls.py | 37 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/materia/test_materia_urls.py b/materia/test_materia_urls.py index a2c41d996..caad5f965 100644 --- a/materia/test_materia_urls.py +++ b/materia/test_materia_urls.py @@ -1,21 +1,22 @@ from django.core.urlresolvers import reverse +import pytest -def test_urls_materia(): - st = reverse('materia:pesquisar_materia_list') - assert st == '/materia/pesquisar-materia-list' - - st = reverse('materia:relatoria_edit', kwargs={'pk': '11', 'id': '99'}) - assert st == '/materia/11/relatoria/99/edit' - - st = reverse('materia:tramitacao_edit', kwargs={'pk': '3', 'id': '8'}) - assert st == '/materia/3/tramitacao/8/edit' - - st = reverse('materia:adicionar_proposicao') - assert st == '/materia/proposicao' - - st = reverse('materia:editar_proposicao', kwargs={'pk': '3'}) - assert st == '/materia/proposicao/3/edit' - - st = reverse('materia:list_proposicao') - assert st == '/materia/proposicao_list' +@pytest.mark.parametrize("test_input,kwargs,expected", [ + ('materia:pesquisar_materia_list', + {}, + '/materia/pesquisar-materia-list'), + ('materia:relatoria_edit', + {'pk': '11', 'id': '99'}, + '/materia/11/relatoria/99/edit'), + ('materia:tramitacao_edit', + {'pk': '3', 'id': '8'}, + '/materia/3/tramitacao/8/edit'), + ('materia:adicionar_proposicao', {}, '/materia/proposicao'), + ('materia:editar_proposicao', + {'pk': '3'}, + '/materia/proposicao/3/edit'), + ('materia:list_proposicao', {}, '/materia/proposicao_list'), +]) +def test_reverse(test_input, kwargs, expected): + assert reverse(test_input, kwargs=kwargs) == expected From 69429a3385e7b60aae2827c3c9364f464452cc4b Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Mon, 4 Apr 2016 13:10:34 -0300 Subject: [PATCH 15/17] Adiciona namespaces a urls --- base/views.py | 2 +- materia/test_materia.py | 4 ++-- materia/views.py | 4 ++-- norma/test_norma.py | 4 ++-- parlamentares/views.py | 2 +- templates/materia/legislacao_citada.html | 2 +- templates/materia/relatoria.html | 2 +- templates/norma/normajuridica_detail.html | 6 +++--- templates/norma/normajuridica_list.html | 4 ++-- templates/painel/mensagem.html | 2 +- templates/painel/parlamentares.html | 2 +- templates/painel/votacao.html | 2 +- templates/sessao/pauta/expediente.html | 2 +- templates/sessao/pauta/ordem.html | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/base/views.py b/base/views.py index f5650d0b5..1950ce99a 100644 --- a/base/views.py +++ b/base/views.py @@ -64,4 +64,4 @@ class CasaLegislativaTableAuxView(FormView): return self.render_to_response({'form': form}) def get_success_url(self): - return reverse('casa_legislativa') + return reverse('base:casa_legislativa') diff --git a/materia/test_materia.py b/materia/test_materia.py index 99b78b6c2..d628856bb 100644 --- a/materia/test_materia.py +++ b/materia/test_materia.py @@ -422,7 +422,7 @@ def test_form_errors_relatoria(client): @pytest.mark.django_db(transaction=False) def test_proposicao_submit(client): - response = client.post(reverse('adicionar_proposicao'), + response = client.post(reverse('materia:adicionar_proposicao'), {'tipo': mommy.make(TipoProposicao, pk=3).pk, 'descricao': 'Teste proposição', 'salvar': 'salvar'}, @@ -438,7 +438,7 @@ def test_proposicao_submit(client): @pytest.mark.django_db(transaction=False) def test_form_errors_proposicao(client): - response = client.post(reverse('adicionar_proposicao'), + response = client.post(reverse('materia:adicionar_proposicao'), {'salvar': 'salvar'}, follow=True) diff --git a/materia/views.py b/materia/views.py index 794aadb5c..35957c0c2 100644 --- a/materia/views.py +++ b/materia/views.py @@ -64,7 +64,7 @@ class FormularioSimplificadoView(CreateView): class FormularioCadastroView(CreateView): template_name = "materia/formulario_cadastro.html" form_class = FormularioCadastroForm - success_url = reverse_lazy('formulario_cadastro') + success_url = reverse_lazy('materia:formulario_cadastro') class MateriaAnexadaView(FormView): @@ -1191,7 +1191,7 @@ class MateriaLegislativaPesquisaView(FormView): template_name = 'materia/pesquisa_materia.html' def get_success_url(self): - return reverse('pesquisar_materia') + return reverse('materia:pesquisar_materia') def get(self, request, *args, **kwargs): form = MateriaLegislativaPesquisaForm() diff --git a/norma/test_norma.py b/norma/test_norma.py index 3743a7159..4731995b2 100644 --- a/norma/test_norma.py +++ b/norma/test_norma.py @@ -13,7 +13,7 @@ def test_incluir_norma_submit(client): descricao='Teste') # Testa POST - response = client.post(reverse('norma_incluir'), + response = client.post(reverse('norma:norma_incluir'), {'tipo': tipo.pk, 'numero': '1', 'ano': '2016', @@ -33,7 +33,7 @@ def test_incluir_norma_submit(client): @pytest.mark.django_db(transaction=False) def test_incluir_norma_errors(client): - response = client.post(reverse('norma_incluir'), + response = client.post(reverse('norma:norma_incluir'), {'salvar': 'salvar'}, follow=True) diff --git a/parlamentares/views.py b/parlamentares/views.py index 7f171fd2d..4bf61e41d 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -286,7 +286,7 @@ class ParlamentaresDependentesEditView(UpdateView): class MesaDiretoraView(FormView): template_name = "mesa_diretora/mesa_diretora.html" - success_url = reverse_lazy('mesa_diretora') + success_url = reverse_lazy('parlamentares:mesa_diretora') # Essa função avisa quando se pode compor uma Mesa Legislativa) def validation(self, request): diff --git a/templates/materia/legislacao_citada.html b/templates/materia/legislacao_citada.html index 8dc2ff49d..9ed99f31f 100644 --- a/templates/materia/legislacao_citada.html +++ b/templates/materia/legislacao_citada.html @@ -20,7 +20,7 @@ {% for l in legislacao %} - {{l.norma.tipo.descricao}} + {{l.norma.tipo.descricao}} {{l.norma.numero}} {{l.norma.ano}} {{l.disposicoes}} diff --git a/templates/materia/relatoria.html b/templates/materia/relatoria.html index 66397c10d..778b5f355 100644 --- a/templates/materia/relatoria.html +++ b/templates/materia/relatoria.html @@ -19,7 +19,7 @@ {% for r in relatorias %} - {{r.data_designacao_relator|date:'d/m/Y'}} + {{r.data_designacao_relator|date:'d/m/Y'}} {{r.comissao}} {{r.parlamentar}} diff --git a/templates/norma/normajuridica_detail.html b/templates/norma/normajuridica_detail.html index 7487ff7cc..13ec219d4 100644 --- a/templates/norma/normajuridica_detail.html +++ b/templates/norma/normajuridica_detail.html @@ -4,7 +4,7 @@ {% endblock sections_nav %} @@ -21,7 +21,7 @@
{% block actions %} {% endblock actions %} diff --git a/templates/norma/normajuridica_list.html b/templates/norma/normajuridica_list.html index 6d5431bd5..f39f02bf0 100644 --- a/templates/norma/normajuridica_list.html +++ b/templates/norma/normajuridica_list.html @@ -3,7 +3,7 @@ {% load crispy_forms_tags %} {% block base_content %} @@ -21,7 +21,7 @@ {% for obj in object_list %} - {{obj.tipo}} + {{obj.tipo}} {{obj.numero}} {{obj.ano}} {{obj.data}} diff --git a/templates/painel/mensagem.html b/templates/painel/mensagem.html index 607c30fe4..65071a796 100644 --- a/templates/painel/mensagem.html +++ b/templates/painel/mensagem.html @@ -94,7 +94,7 @@

{{ context.title }}

- +

Ajax refresh counter:



diff --git a/templates/painel/parlamentares.html b/templates/painel/parlamentares.html index a9ffd8072..b31e9b1f4 100644 --- a/templates/painel/parlamentares.html +++ b/templates/painel/parlamentares.html @@ -95,7 +95,7 @@

{{ context.title }}

- +





diff --git a/templates/painel/votacao.html b/templates/painel/votacao.html index fa235b8a2..ea77c1727 100644 --- a/templates/painel/votacao.html +++ b/templates/painel/votacao.html @@ -94,7 +94,7 @@

{{ context.title }}

- +





diff --git a/templates/sessao/pauta/expediente.html b/templates/sessao/pauta/expediente.html index 3430b4e3b..75f49af63 100644 --- a/templates/sessao/pauta/expediente.html +++ b/templates/sessao/pauta/expediente.html @@ -38,7 +38,7 @@



- Tramitação{% if expediente.materia.em_tramitacao %} >>> Acompanhar matéria <<<{% endif %} + Tramitação{% if expediente.materia.em_tramitacao %} >>> Acompanhar matéria <<<{% endif %} {% for t in tramitacao %} Data: {{t.data_tramitacao}}
diff --git a/templates/sessao/pauta/ordem.html b/templates/sessao/pauta/ordem.html index 861ca49e3..a57ee2150 100644 --- a/templates/sessao/pauta/ordem.html +++ b/templates/sessao/pauta/ordem.html @@ -46,7 +46,7 @@


- Tramitação{% if ordem.materia.em_tramitacao %} >>> Acompanhar matéria <<<{% endif %} + Tramitação{% if ordem.materia.em_tramitacao %} >>> Acompanhar matéria <<<{% endif %} {% for t in tramitacao %} Data: {{t.data_tramitacao}}
From 506aa077ae8471de4864ec2fd34c1a5077050637 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Mon, 4 Apr 2016 20:49:08 -0300 Subject: [PATCH 16/17] Coloca namespaces nas URLs --- materia/test_materia.py | 30 ++++++++++++------------- materia/test_materia_urls.py | 2 +- materia/views.py | 35 ++++++++++++++++------------- parlamentares/test_parlamentares.py | 20 +++++++++-------- parlamentares/views.py | 3 ++- 5 files changed, 48 insertions(+), 42 deletions(-) diff --git a/materia/test_materia.py b/materia/test_materia.py index d628856bb..04fdfddb4 100644 --- a/materia/test_materia.py +++ b/materia/test_materia.py @@ -98,7 +98,7 @@ def test_materia_anexada_submit(client): materia_anexada = MateriaLegislativa.objects.get(numero=32, ano=2004) # Testa POST - response = client.post(reverse('materia_anexada', + response = client.post(reverse('materia:materia_anexada', kwargs={'pk': materia_principal.pk}), {'tipo': materia_anexada.tipo.pk, 'numero': materia_anexada.numero, @@ -125,7 +125,7 @@ def test_autoria_submit(client): autor = mommy.make(Autor, tipo=tipo_autor, nome='Autor Teste') # Testa POST - response = client.post(reverse('autoria', + response = client.post(reverse('materia:autoria', kwargs={'pk': materia_principal.pk}), {'autor': autor.pk, 'primeiro_autor': True, @@ -155,7 +155,7 @@ def test_despacho_inicial_submit(client): data_criacao='2016-03-18') # Testa POST - response = client.post(reverse('despacho_inicial', + response = client.post(reverse('materia:despacho_inicial', kwargs={'pk': materia_principal.pk}), {'comissao': comissao.pk, 'salvar': 'salvar'}, @@ -177,7 +177,7 @@ def test_numeracao_submit(client): sigla='T2', descricao='Teste_2') # Testa POST - response = client.post(reverse('numeracao', + response = client.post(reverse('materia:numeracao', kwargs={'pk': materia_principal.pk}), {'tipo_materia': tipo.pk, 'numero_materia': '341', @@ -209,7 +209,7 @@ def test_documento_acessorio_submit(client): descricao='Teste') # Testa POST - response = client.post(reverse('documento_acessorio', + response = client.post(reverse('materia:documento_acessorio', kwargs={'pk': materia_principal.pk}), {'tipo': tipo.pk, 'nome': 'teste_nome', @@ -234,7 +234,7 @@ def test_legislacao_citada_submit(client): norma = make_norma() # Testa POST - response = client.post(reverse('legislacao_citada', + response = client.post(reverse('materia:legislacao_citada', kwargs={'pk': materia_principal.pk}), {'tipo': norma.tipo.pk, 'numero': norma.numero, @@ -260,7 +260,7 @@ def test_tramitacao_submit(client): descricao='Status_Teste') # Testa POST response = client.post( - reverse('tramitacao_materia', + reverse('materia:tramitacao_materia', kwargs={'pk': materia_principal.pk}), {'unidade_tramitacao_local': make_unidade_tramitacao( 'Unidade Local').pk, @@ -287,7 +287,7 @@ def test_tramitacao_submit(client): @pytest.mark.django_db(transaction=False) def test_form_errors_anexada(client): materia_principal = make_materia_principal() - response = client.post(reverse('materia_anexada', + response = client.post(reverse('materia:materia_anexada', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -306,7 +306,7 @@ def test_form_errors_anexada(client): def test_form_errors_autoria(client): materia_principal = make_materia_principal() - response = client.post(reverse('autoria', + response = client.post(reverse('materia:autoria', kwargs={'pk': materia_principal.pk}), {'materia_id': materia_principal.pk, 'partido': '', @@ -324,7 +324,7 @@ def test_form_errors_autoria(client): def test_form_errors_despacho_inicial(client): materia_principal = make_materia_principal() - response = client.post(reverse('despacho_inicial', + response = client.post(reverse('materia:despacho_inicial', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -337,7 +337,7 @@ def test_form_errors_despacho_inicial(client): def test_form_errors_documento_acessorio(client): materia_principal = make_materia_principal() - response = client.post(reverse('documento_acessorio', + response = client.post(reverse('materia:documento_acessorio', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -352,7 +352,7 @@ def test_form_errors_documento_acessorio(client): def test_form_errors_legislacao_citada(client): materia_principal = make_materia_principal() - response = client.post(reverse('legislacao_citada', + response = client.post(reverse('materia:legislacao_citada', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -369,7 +369,7 @@ def test_form_errors_legislacao_citada(client): def test_form_errors_numeracao(client): materia_principal = make_materia_principal() - response = client.post(reverse('numeracao', + response = client.post(reverse('materia:numeracao', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -388,7 +388,7 @@ def test_form_errors_numeracao(client): def test_form_errors_tramitacao(client): materia_principal = make_materia_principal() - response = client.post(reverse('tramitacao_materia', + response = client.post(reverse('materia:tramitacao_materia', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) @@ -409,7 +409,7 @@ def test_form_errors_tramitacao(client): def test_form_errors_relatoria(client): materia_principal = make_materia_principal() - response = client.post(reverse('relatoria', + response = client.post(reverse('materia:relatoria', kwargs={'pk': materia_principal.pk}), {'salvar': 'salvar'}, follow=True) diff --git a/materia/test_materia_urls.py b/materia/test_materia_urls.py index caad5f965..9814612a7 100644 --- a/materia/test_materia_urls.py +++ b/materia/test_materia_urls.py @@ -1,5 +1,5 @@ -from django.core.urlresolvers import reverse import pytest +from django.core.urlresolvers import reverse @pytest.mark.parametrize("test_input,kwargs,expected", [ diff --git a/materia/views.py b/materia/views.py index 35957c0c2..fd417ada7 100644 --- a/materia/views.py +++ b/materia/views.py @@ -223,7 +223,7 @@ class MateriaAnexadaEditView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('materia_anexada', kwargs={'pk': pk}) + return reverse('materia:materia_anexada', kwargs={'pk': pk}) class DespachoInicialView(CreateView): @@ -294,7 +294,7 @@ class DespachoInicialEditView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('despacho_inicial', kwargs={'pk': pk}) + return reverse('materia:despacho_inicial', kwargs={'pk': pk}) class LegislacaoCitadaView(FormView): @@ -355,7 +355,7 @@ class LegislacaoCitadaView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('legislacao_citada', kwargs={'pk': pk}) + return reverse('materia:legislacao_citada', kwargs={'pk': pk}) class LegislacaoCitadaEditView(FormView): @@ -364,7 +364,7 @@ class LegislacaoCitadaEditView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('legislacao_citada', kwargs={'pk': pk}) + return reverse('materia:legislacao_citada', kwargs={'pk': pk}) def get(self, request, *args, **kwargs): materia = MateriaLegislativa.objects.get(id=kwargs['pk']) @@ -494,7 +494,7 @@ class NumeracaoEditView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('numeracao', kwargs={'pk': pk}) + return reverse('materia:numeracao', kwargs={'pk': pk}) class DocumentoAcessorioView(CreateView): @@ -601,7 +601,7 @@ class DocumentoAcessorioEditView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('documento_acessorio', kwargs={'pk': pk}) + return reverse('materia:documento_acessorio', kwargs={'pk': pk}) class RelatoriaEditView(FormView): @@ -610,7 +610,7 @@ class RelatoriaEditView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('relatoria', kwargs={'pk': pk}) + return reverse('materia:relatoria', kwargs={'pk': pk}) def get(self, request, *args, **kwargs): form = RelatoriaForm() @@ -667,7 +667,7 @@ class RelatoriaView(FormView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('relatoria', kwargs={'pk': pk}) + return reverse('materia:relatoria', kwargs={'pk': pk}) def post(self, request, *args, **kwargs): form = RelatoriaForm(request.POST) @@ -807,8 +807,9 @@ def criar_email_confirmacao(request, casa_legislativa, materia, hash_txt=''): casa_legislativa.uf) base_url = get_base_url(request) - materia_url = reverse('acompanhar_materia', kwargs={'pk': materia.id}) - confirmacao_url = reverse('acompanhar_confirmar', + materia_url = reverse('materia:acompanhar_materia', + kwargs={'pk': materia.id}) + confirmacao_url = reverse('materia:acompanhar_confirmar', kwargs={'pk': materia.id}) autores = [] @@ -843,8 +844,10 @@ def criar_email_tramitacao(request, casa_legislativa, materia, hash_txt=''): casa_legislativa.uf) base_url = get_base_url(request) - url_materia = reverse('acompanhar_materia', kwargs={'pk': materia.id}) - url_excluir = reverse('acompanhar_excluir', kwargs={'pk': materia.id}) + url_materia = reverse('materia:acompanhar_materia', + kwargs={'pk': materia.id}) + url_excluir = reverse('materia:acompanhar_excluir', + kwargs={'pk': materia.id}) autores = [] for autoria in materia.autoria_set.all(): @@ -1027,7 +1030,7 @@ class TramitacaoView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('tramitacao_materia', kwargs={'pk': pk}) + return reverse('materia:tramitacao_materia', kwargs={'pk': pk}) class TramitacaoEditView(CreateView): @@ -1082,7 +1085,7 @@ class TramitacaoEditView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('tramitacao_materia', kwargs={'pk': pk}) + return reverse('materia:tramitacao_materia', kwargs={'pk': pk}) class AutoriaView(CreateView): @@ -1124,7 +1127,7 @@ class AutoriaView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('autoria', kwargs={'pk': pk}) + return reverse('materia:autoria', kwargs={'pk': pk}) class AutoriaEditView(CreateView): @@ -1163,7 +1166,7 @@ class AutoriaEditView(CreateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('autoria', kwargs={'pk': pk}) + return reverse('materia:autoria', kwargs={'pk': pk}) class ProposicaoListView(ListView): diff --git a/parlamentares/test_parlamentares.py b/parlamentares/test_parlamentares.py index e8ea6c3bc..4668adda4 100644 --- a/parlamentares/test_parlamentares.py +++ b/parlamentares/test_parlamentares.py @@ -10,10 +10,12 @@ from .models import (Dependente, Filiacao, Legislatura, Mandato, Parlamentar, def test_cadastro_parlamentar(client): mommy.make(Legislatura, pk=5) - response = client.get(reverse('parlamentares_cadastro', kwargs={'pk': 5})) + response = client.get(reverse('parlamentares:parlamentares_cadastro', + kwargs={'pk': 5})) assert response.status_code == 200 - response = client.post(reverse('parlamentares_cadastro', kwargs={'pk': 5}), + response = client.post(reverse('parlamentares:parlamentares_cadastro', + kwargs={'pk': 5}), {'nome_completo': 'Teresa Barbosa', 'nome_parlamentar': 'Terezinha', 'sexo': 'F', @@ -30,7 +32,7 @@ def test_filiacao_submit(client): mommy.make(Parlamentar, pk=14) mommy.make(Partido, pk=32) - client.post(reverse('parlamentares_filiacao', + client.post(reverse('parlamentares:parlamentares_filiacao', kwargs={'pk': 14}), {'partido': 32, 'data': '2016-03-22', @@ -47,7 +49,7 @@ def test_dependente_submit(client): mommy.make(Partido, pk=32) mommy.make(TipoDependente, pk=3) - client.post(reverse('parlamentares_dependentes', + client.post(reverse('parlamentares:parlamentares_dependentes', kwargs={'pk': 14}), {'nome': 'Eduardo', 'tipo': 3, @@ -63,7 +65,7 @@ def test_dependente_submit(client): @pytest.mark.django_db(transaction=False) def test_form_errors_dependente(client): mommy.make(Parlamentar, pk=14) - response = client.post(reverse('parlamentares_dependentes', + response = client.post(reverse('parlamentares:parlamentares_dependentes', kwargs={'pk': 14}), {'salvar': 'salvar'}, follow=True) @@ -80,7 +82,7 @@ def test_form_errors_dependente(client): def test_form_errors_filiacao(client): mommy.make(Parlamentar, pk=14) - response = client.post(reverse('parlamentares_filiacao', + response = client.post(reverse('parlamentares:parlamentares_filiacao', kwargs={'pk': 14}), {'partido': '', 'salvar': 'salvar'}, @@ -97,7 +99,7 @@ def test_mandato_submit(client): mommy.make(Parlamentar, pk=14) mommy.make(Legislatura, pk=5) - client.post(reverse('parlamentares_mandato', + client.post(reverse('parlamentares:parlamentares_mandato', kwargs={'pk': 14}), {'legislatura': 5, 'data_fim_mandato': '2016-01-01', @@ -113,7 +115,7 @@ def test_mandato_submit(client): @pytest.mark.django_db(transaction=False) def test_form_errors_mandato(client): mommy.make(Parlamentar, pk=14) - response = client.post(reverse('parlamentares_mandato', + response = client.post(reverse('parlamentares:parlamentares_mandato', kwargs={'pk': 14}), {'legislatura': '', 'salvar': 'salvar'}, @@ -131,7 +133,7 @@ def test_form_errors_mandato(client): def test_incluir_parlamentar_errors(client): mommy.make(Legislatura, pk=5) - response = client.post(reverse('parlamentares_cadastro', + response = client.post(reverse('parlamentares:parlamentares_cadastro', kwargs={'pk': 5}), {'salvar': 'salvar'}, follow=True) diff --git a/parlamentares/views.py b/parlamentares/views.py index 4bf61e41d..b32bef99a 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -519,7 +519,8 @@ class MandatoEditView(UpdateView): def get_success_url(self): pk = self.kwargs['pk'] - return reverse('parlamentares_mandato', kwargs={'pk': pk}) + return reverse('parlamentares:parlamentares_mandato', + kwargs={'pk': pk}) def get_context_data(self, **kwargs): context = super(MandatoEditView, self).get_context_data(**kwargs) From 2f8d3cbc88f1c6e97f178771d33cebc8cbf021eb Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Tue, 5 Apr 2016 09:36:44 -0300 Subject: [PATCH 17/17] Corrige erros pontuais de namespace --- comissoes/test_comissoes.py | 8 ++++---- norma/views.py | 4 ++-- templates/materia/proposicao/proposicao_list.html | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/comissoes/test_comissoes.py b/comissoes/test_comissoes.py index 1eefaefec..5b4c60e76 100644 --- a/comissoes/test_comissoes.py +++ b/comissoes/test_comissoes.py @@ -54,7 +54,7 @@ def test_incluir_parlamentar_submit(client): nome='Cargo', unico=True) - response = client.post(reverse('comissao:comissao_parlamentar', + response = client.post(reverse('comissoes:comissao_parlamentar', kwargs={'pk': comissao.pk, 'id': composicao.pk}), {'parlamentar_id': filiacao.pk, @@ -76,7 +76,7 @@ def test_incluir_parlamentar_errors(client): comissao = make_comissao() composicao = make_composicao(comissao) - response = client.post(reverse('comissao:comissao_parlamentar', + response = client.post(reverse('comissoes:comissao_parlamentar', kwargs={'pk': comissao.pk, 'id': composicao.pk}), {'salvar': 'salvar'}, @@ -96,7 +96,7 @@ def test_incluir_comissao_submit(client): sigla='T', nome='Teste') - response = client.post(reverse('comissao:cadastrar_comissao'), + response = client.post(reverse('comissoes:cadastrar_comissao'), {'tipo': tipo.pk, 'nome': 'Comissão Teste', 'sigla': 'CT', @@ -113,7 +113,7 @@ def test_incluir_comissao_submit(client): @pytest.mark.django_db(transaction=False) def test_incluir_comissao_errors(client): - response = client.post(reverse('comissao:cadastrar_comissao'), + response = client.post(reverse('comissoes:cadastrar_comissao'), {'salvar': 'salvar'}, follow=True) diff --git a/norma/views.py b/norma/views.py index 3825f88f3..116405ad6 100644 --- a/norma/views.py +++ b/norma/views.py @@ -116,7 +116,7 @@ class NormaIncluirView(CreateView): success_url = reverse_lazy('norma:normajuridica_list') def get_success_url(self): - return reverse_lazy('normajuridica:list') + return reverse_lazy('norma:norma_pesquisa') def form_valid(self, form): norma = form.save(commit=False) @@ -135,7 +135,7 @@ class NormaEditView(UpdateView): template_name = "norma/normajuridica_incluir.html" form_class = NormaJuridicaForm model = NormaJuridica - success_url = reverse_lazy('norma:list') + success_url = reverse_lazy('norma:pesquisa_norma') def get_initial(self): data = super(NormaEditView, self).get_initial() diff --git a/templates/materia/proposicao/proposicao_list.html b/templates/materia/proposicao/proposicao_list.html index a671cde0c..afbad4ade 100644 --- a/templates/materia/proposicao/proposicao_list.html +++ b/templates/materia/proposicao/proposicao_list.html @@ -10,7 +10,7 @@ {% block detail_content %}

Proposições