From 380d9e45deb2b5459d17351c01836cdfb7305f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Fri, 7 Feb 2020 13:45:16 -0300 Subject: [PATCH] Adiciona campos em Casas e Contatos da Casa --- sigi/apps/casas/admin.py | 18 ++++++++++--- .../migrations/0003_auto_20200207_0919.py | 26 +++++++++++++++++++ sigi/apps/casas/models.py | 11 ++++++-- 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 sigi/apps/casas/migrations/0003_auto_20200207_0919.py diff --git a/sigi/apps/casas/admin.py b/sigi/apps/casas/admin.py index 7c998e0..e84c73e 100644 --- a/sigi/apps/casas/admin.py +++ b/sigi/apps/casas/admin.py @@ -34,7 +34,14 @@ class TelefonesInline(generic.GenericTabularInline): class PresidenteInline(admin.StackedInline): model = Presidente - exclude = ['cargo', 'funcao'] + fieldsets = ((None, { + 'fields': ( + ('nome', 'sexo', 'data_nascimento'), + ('nota', 'email', 'tempo_de_servico'), + ('ult_alteracao',), + ) + }),) +# exclude = ['setor', 'cargo', 'funcao'] readonly_fields = ('ult_alteracao',) extra = 1 max_num = 1 @@ -44,7 +51,12 @@ class PresidenteInline(admin.StackedInline): class FuncionariosInline(admin.StackedInline): model = Funcionario fieldsets = ((None, { - 'fields': (('nome', 'sexo', 'nota', 'email'), ('cargo', 'funcao', 'setor', 'tempo_de_servico'), 'ult_alteracao') + 'fields': ( + ('nome', 'sexo', 'data_nascimento'), + ('nota', 'email'), + ('cargo', 'funcao', 'setor'), + ('tempo_de_servico', 'ult_alteracao'), + ) }),) readonly_fields = ('ult_alteracao',) extra = 1 @@ -269,7 +281,7 @@ class CasaLegislativaAdmin(ImageCroppingMixin, BaseModelAdmin): 'fields': ('inclusao_digital', 'data_levantamento', 'pesquisador', 'pagina_web', 'email', 'obs_pesquisa',) }), (_(u'Outras informações'), { - 'fields': ('observacoes', 'foto', 'recorte'), + 'fields': ('observacoes', 'horario_funcionamento', 'foto', 'recorte'), }), ) raw_id_fields = ('municipio',) diff --git a/sigi/apps/casas/migrations/0003_auto_20200207_0919.py b/sigi/apps/casas/migrations/0003_auto_20200207_0919.py new file mode 100644 index 0000000..ffc534f --- /dev/null +++ b/sigi/apps/casas/migrations/0003_auto_20200207_0919.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('casas', '0002_auto_20150710_1247'), + ] + + operations = [ + migrations.AddField( + model_name='casalegislativa', + name='horario_funcionamento', + field=models.CharField(max_length=100, verbose_name='Hor\xe1rio de funcionamento da Casa Legislativa', blank=True), + preserve_default=True, + ), + migrations.AddField( + model_name='funcionario', + name='data_nascimento', + field=models.DateField(null=True, verbose_name='Data de nascimento', blank=True), + preserve_default=True, + ), + ] diff --git a/sigi/apps/casas/models.py b/sigi/apps/casas/models.py index b199579..38f2138 100644 --- a/sigi/apps/casas/models.py +++ b/sigi/apps/casas/models.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- +from datetime import datetime import random from string import ascii_uppercase from unicodedata import normalize -from datetime import datetime from django.contrib.contenttypes import generic from django.db import models from image_cropping import ImageRatioField @@ -54,6 +54,11 @@ class CasaLegislativa(models.Model): tipo = models.ForeignKey(TipoCasaLegislativa, verbose_name="Tipo") cnpj = models.CharField('CNPJ', max_length=32, blank=True) observacoes = models.TextField(u'observações', blank=True) + horario_funcionamento = models.CharField( + u"Horário de funcionamento da Casa Legislativa", + max_length=100, + blank=True, + ) # num_parlamentares = models.PositiveIntegerField('Número de parlamentares') codigo_interlegis = models.CharField('Código Interlegis', max_length=3, blank=True) # codigo_interlegis.ts_filter = True @@ -93,7 +98,7 @@ class CasaLegislativa(models.Model): height_field='foto_altura', blank=True ) - recorte = ImageRatioField('foto', '400x300', verbose_name="Recorte", ) + recorte = ImageRatioField('foto', '400x300', verbose_name="Recorte",) foto_largura = models.SmallIntegerField(editable=False, null=True) foto_altura = models.SmallIntegerField(editable=False, null=True) data_instalacao = models.DateField(u'Data de instalação da Casa Legislativa', null=True, blank=True) @@ -291,6 +296,8 @@ class Funcionario(models.Model): nome = models.CharField('nome completo', max_length=60, blank=False) # nome.alphabetic_filter = True sexo = models.CharField(max_length=1, choices=SEXO_CHOICES, default="M") + data_nascimento = models.DateField(u"Data de nascimento", blank=True, + null=True) nota = models.CharField(max_length=70, null=True, blank=True) email = models.CharField('e-mail', max_length=75, blank=True) telefones = generic.GenericRelation('contatos.Telefone')