From c8d5f0a186d4ab19c2b6a1702701b6074ebb3029 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 19 Sep 2016 10:29:06 -0300 Subject: [PATCH 1/6] Adiciona campo tipo ao model de casa --- sapl/base/forms.py | 2 ++ .../migrations/0017_casalegislativa_tipo.py | 20 +++++++++++++++++++ sapl/base/models.py | 7 ++++++- sapl/templates/base/layouts.yaml | 3 ++- sapl/utils.py | 5 +++++ 5 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 sapl/base/migrations/0017_casalegislativa_tipo.py diff --git a/sapl/base/forms.py b/sapl/base/forms.py index 8a28dabbe..8bff1f4fa 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -242,6 +242,7 @@ class CasaLegislativaForm(ModelForm): model = CasaLegislativa fields = ['codigo', + 'tipo', 'nome', 'sigla', 'endereco', @@ -257,6 +258,7 @@ class CasaLegislativaForm(ModelForm): widgets = { 'uf': forms.Select(attrs={'class': 'selector'}), + 'tipo': forms.Select(attrs={'class': 'selector'}), 'cep': forms.TextInput(attrs={'class': 'cep'}), 'telefone': forms.TextInput(attrs={'class': 'telefone'}), 'fax': forms.TextInput(attrs={'class': 'telefone'}), diff --git a/sapl/base/migrations/0017_casalegislativa_tipo.py b/sapl/base/migrations/0017_casalegislativa_tipo.py new file mode 100644 index 000000000..abfd7c961 --- /dev/null +++ b/sapl/base/migrations/0017_casalegislativa_tipo.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-19 13:26 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0016_auto_20160701_0940'), + ] + + operations = [ + migrations.AddField( + model_name='casalegislativa', + name='tipo', + field=models.CharField(blank=True, choices=[('A', 'Assembleia Legislativa'), ('C', 'Casa Legislativa')], max_length=1, verbose_name='Tipo'), + ), + ] diff --git a/sapl/base/models.py b/sapl/base/models.py index 86a685ef4..081d25b3b 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -3,7 +3,7 @@ from django.contrib.contenttypes.models import ContentType from django.db import models from django.utils.translation import ugettext_lazy as _ -from sapl.utils import UF, YES_NO_CHOICES +from sapl.utils import UF, YES_NO_CHOICES, CASA_CHOICES TIPO_DOCUMENTO_ADMINISTRATIVO = (('O', _('Ostensivo')), ('R', _('Restritivo'))) @@ -50,6 +50,11 @@ class CasaLegislativa(models.Model): blank=True, verbose_name=_('Informação Geral')) + # Determina se é Assembleia ou Casa + tipo = models.CharField( + max_length=1, blank=True, verbose_name=_('Tipo'), + choices=CASA_CHOICES) + class Meta: verbose_name = _('Casa Legislativa') verbose_name_plural = _('Casa Legislativa') diff --git a/sapl/templates/base/layouts.yaml b/sapl/templates/base/layouts.yaml index ebe0abc8b..fecd5b06d 100644 --- a/sapl/templates/base/layouts.yaml +++ b/sapl/templates/base/layouts.yaml @@ -1,7 +1,8 @@ {% load i18n %} + CasaLegislativa: {% trans 'Casa Legislativa' %}: - - codigo:2 nome sigla + - codigo:1 tipo:3 nome sigla - endereco:8 cep - municipio:10 uf - telefone fax diff --git a/sapl/utils.py b/sapl/utils.py index 3f63c30df..53ce7f64c 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -111,6 +111,11 @@ TURNO_TRAMITACAO_CHOICES = [ ('C', _('2ª e 3ª Votação')), ] +CASA_CHOICES = [ + ('A', _('Assembleia Legislativa')), + ('C', _('Casa Legislativa')), +] + def listify(function): @wraps(function) From 5af5a877201646205fb0dda1da3d1c44f20e2e5a Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 19 Sep 2016 10:35:43 -0300 Subject: [PATCH 2/6] Torna o rodape um arquivo separado --- sapl/templates/base.html | 51 +------------------------------------ sapl/templates/rodape.html | 52 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 50 deletions(-) create mode 100644 sapl/templates/rodape.html diff --git a/sapl/templates/base.html b/sapl/templates/base.html index 03617f5ac..c6630ee67 100644 --- a/sapl/templates/base.html +++ b/sapl/templates/base.html @@ -224,56 +224,7 @@ {% endblock content_container %} - - + {% include 'rodape.html' %} {% block foot_js %} diff --git a/sapl/templates/rodape.html b/sapl/templates/rodape.html new file mode 100644 index 000000000..730f6ade4 --- /dev/null +++ b/sapl/templates/rodape.html @@ -0,0 +1,52 @@ +{% load i18n staticfiles sass_tags menus %} +{% load common_tags %} + + From 6b33db5c5bf203bc0a7574974a7d74c191cd41c2 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 19 Sep 2016 10:36:27 -0300 Subject: [PATCH 3/6] =?UTF-8?q?Torna=20tipo=20da=20casa=20obrigat=C3=B3rio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0018_auto_20160919_1036.py | 20 +++++++++++++++++++ sapl/base/models.py | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 sapl/base/migrations/0018_auto_20160919_1036.py diff --git a/sapl/base/migrations/0018_auto_20160919_1036.py b/sapl/base/migrations/0018_auto_20160919_1036.py new file mode 100644 index 000000000..1c69b27ad --- /dev/null +++ b/sapl/base/migrations/0018_auto_20160919_1036.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-19 13:36 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0017_casalegislativa_tipo'), + ] + + operations = [ + migrations.AlterField( + model_name='casalegislativa', + name='tipo', + field=models.CharField(choices=[('A', 'Assembleia Legislativa'), ('C', 'Casa Legislativa')], max_length=1, verbose_name='Tipo'), + ), + ] diff --git a/sapl/base/models.py b/sapl/base/models.py index 081d25b3b..d82576de5 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -52,7 +52,7 @@ class CasaLegislativa(models.Model): # Determina se é Assembleia ou Casa tipo = models.CharField( - max_length=1, blank=True, verbose_name=_('Tipo'), + max_length=1, verbose_name=_('Tipo'), choices=CASA_CHOICES) class Meta: From f103741cdd20e42791691ccf2bbd3166fb0687f9 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 19 Sep 2016 10:58:46 -0300 Subject: [PATCH 4/6] Configura rodape para se adaptar a camara e assembleia --- .../migrations/0019_auto_20160919_1040.py | 20 +++++++++++++++++++ sapl/base/models.py | 2 +- sapl/templates/rodape.html | 15 +++++++++++--- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 sapl/base/migrations/0019_auto_20160919_1040.py diff --git a/sapl/base/migrations/0019_auto_20160919_1040.py b/sapl/base/migrations/0019_auto_20160919_1040.py new file mode 100644 index 000000000..c7849471b --- /dev/null +++ b/sapl/base/migrations/0019_auto_20160919_1040.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-19 13:40 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0018_auto_20160919_1036'), + ] + + operations = [ + migrations.AlterField( + model_name='casalegislativa', + name='tipo', + field=models.CharField(choices=[('A', 'Assembleia Legislativa'), ('C', 'Casa Legislativa')], default='C', max_length=1, verbose_name='Tipo'), + ), + ] diff --git a/sapl/base/models.py b/sapl/base/models.py index d82576de5..6feb82ad8 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -53,7 +53,7 @@ class CasaLegislativa(models.Model): # Determina se é Assembleia ou Casa tipo = models.CharField( max_length=1, verbose_name=_('Tipo'), - choices=CASA_CHOICES) + choices=CASA_CHOICES, default='C') class Meta: verbose_name = _('Casa Legislativa') diff --git a/sapl/templates/rodape.html b/sapl/templates/rodape.html index 730f6ade4..a327d3145 100644 --- a/sapl/templates/rodape.html +++ b/sapl/templates/rodape.html @@ -31,18 +31,27 @@
- {{ nome }} de {{ municipio }} - {{ uf }} + {% if tipo == 'A' %} + Assembleia Legislativa de {{ municipio }} - {{ uf }} + {% else %} + Câmara Municipal de {{ municipio }} - {{ uf }} + {% endif %}
{{ endereco }}
CEP: {{ cep }} | Telefone: {{ telefone }}
- {% trans 'Site da Câmara' %} | + + {% if tipo == 'A' %} + {% trans 'Site da Assembleia' %} + {% else %} + {% trans 'Site da Câmara' %} + {% endif %} |
{% else %} - Casa Legislativa não configurada. + Casa/Assembleia Legislativa não configurada.
Favor configurar clicando aqui {% endif %} From 1d563f519569c7baf63768fbcee83da946d77a4f Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 19 Sep 2016 11:11:18 -0300 Subject: [PATCH 5/6] Adapta nome no topo --- sapl/templates/base.html | 1 + 1 file changed, 1 insertion(+) diff --git a/sapl/templates/base.html b/sapl/templates/base.html index c6630ee67..36a87b954 100644 --- a/sapl/templates/base.html +++ b/sapl/templates/base.html @@ -164,6 +164,7 @@ alt="Logo" class="img-responsive visible-lg-inline-block vcenter" > {# XXX Make better use of translation tags in html blocks ie. actually use the proper blocktrans tag efficiently #} + {% if tipo == 'C' %} Casa Municipal {% else %} Assembleia Legislativa {% endif %} {% if nome %} {{ nome }} {% trans 'de' %} {{ municipio }} - {{ uf }} {% else %} From c440a1a1d5405655e70754a3f2c7605a2195ba90 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 19 Sep 2016 13:35:09 -0300 Subject: [PATCH 6/6] Merge migrate --- sapl/base/migrations/0020_merge.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sapl/base/migrations/0020_merge.py diff --git a/sapl/base/migrations/0020_merge.py b/sapl/base/migrations/0020_merge.py new file mode 100644 index 000000000..5ffa8a55a --- /dev/null +++ b/sapl/base/migrations/0020_merge.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-19 16:34 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0018_auto_20160919_1333'), + ('base', '0019_auto_20160919_1040'), + ] + + operations = [ + ]