diff --git a/sigi/apps/casas/admin.py b/sigi/apps/casas/admin.py index 7cd039e..de91b80 100644 --- a/sigi/apps/casas/admin.py +++ b/sigi/apps/casas/admin.py @@ -308,9 +308,9 @@ class OrgaoAdmin(ImageCroppingMixin, BaseModelAdmin): actions = ['adicionar_casas', ] inlines = (TelefonesInline, PresidenteInline, FuncionariosInline, ConveniosInline, ServicoInline, OcorrenciaInline,) - list_display = ('nome', 'get_uf', 'get_gerentes', 'get_convenios', + list_display = ('sigla', 'nome', 'get_uf', 'get_gerentes', 'get_convenios', 'get_servicos') - list_display_links = ('nome',) + list_display_links = ('sigla', 'nome',) list_filter = ('tipo', ('gerentes_interlegis', GerentesInterlegisFilter), 'municipio__uf__nome', ConvenioFilter, ServicoFilter, 'inclusao_digital',) @@ -318,7 +318,7 @@ class OrgaoAdmin(ImageCroppingMixin, BaseModelAdmin): queryset = queryset_ascii fieldsets = ( (None, { - 'fields': ('tipo', 'nome', 'cnpj', 'num_parlamentares', + 'fields': ('tipo', 'nome', 'sigla', 'cnpj', 'num_parlamentares', 'gerentes_interlegis') }), (_(u'Endereço'), { @@ -336,10 +336,10 @@ class OrgaoAdmin(ImageCroppingMixin, BaseModelAdmin): ) raw_id_fields = ('municipio',) readonly_fields = ['num_parlamentares', 'gerentes_interlegis',] - search_fields = ('search_text', 'cnpj', 'bairro', 'logradouro', + search_fields = ('search_text', 'sigla', 'cnpj', 'bairro', 'logradouro', 'cep', 'municipio__nome', 'municipio__uf__nome', 'municipio__codigo_ibge', 'pagina_web', 'observacoes') - filter_horizontal = ('gerentes_interlegis',) + # filter_horizontal = ('gerentes_interlegis',) def get_uf(self, obj): return obj.municipio.uf.nome diff --git a/sigi/apps/casas/migrations/0018_orgao_sigla.py b/sigi/apps/casas/migrations/0018_orgao_sigla.py new file mode 100644 index 0000000..fcc6370 --- /dev/null +++ b/sigi/apps/casas/migrations/0018_orgao_sigla.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('casas', '0017_auto_20210416_0841'), + ] + + operations = [ + migrations.AddField( + model_name='orgao', + name='sigla', + field=models.CharField(max_length=30, verbose_name='sigla do \xf3rg\xe3o', blank=True), + preserve_default=True, + ), + ] diff --git a/sigi/apps/casas/models.py b/sigi/apps/casas/models.py index b9ce584..4a63403 100644 --- a/sigi/apps/casas/models.py +++ b/sigi/apps/casas/models.py @@ -47,10 +47,13 @@ class Orgao(models.Model): max_length=60, help_text=_(u'Exemplo: Câmara Municipal de Pains.') ) - + sigla = models.CharField( + _(u"sigla do órgão"), + max_length=30, + blank=True + ) # Guarda um campo para ser usado em buscas em caixa baixa e sem acento search_text = SearchField(field_names=['nome']) - # search_text.projeto_filter = True tipo = models.ForeignKey( TipoOrgao, on_delete=models.PROTECT,