From 2378bd9aabc7c6a4eec11f2543a598c6a16220a6 Mon Sep 17 00:00:00 2001 From: Felipe Vieira Date: Thu, 24 Nov 2011 17:38:33 +0000 Subject: [PATCH] melhorando admin de perguntas e escolhas --- sigi/apps/diagnosticos/admin.py | 7 ++++++- sigi/apps/diagnosticos/models.py | 1 + sigi/sites.py | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sigi/apps/diagnosticos/admin.py b/sigi/apps/diagnosticos/admin.py index 691df27..0ab8dc6 100644 --- a/sigi/apps/diagnosticos/admin.py +++ b/sigi/apps/diagnosticos/admin.py @@ -51,10 +51,15 @@ class DiagnosticoAdmin(BaseEntityAdmin): })) class PerguntaAdmin (BaseSchemaAdmin): + search_fields = ('title', 'help_text', 'name',) list_display = ('title', 'categoria', 'datatype', 'help_text', 'required') + list_filter = ('datatype', 'categoria', 'required') class EscolhaAdmin(admin.ModelAdmin): - list_display = ('title', 'schema') + search_fields = ('title',) + list_display = ('title', 'schema', 'schema_to_open') + raw_id_fields = ('schema', 'schema_to_open') + ordering = ('schema', 'title') admin.site.register(Diagnostico, DiagnosticoAdmin) admin.site.register(Pergunta, PerguntaAdmin) diff --git a/sigi/apps/diagnosticos/models.py b/sigi/apps/diagnosticos/models.py index 771b7d5..dc40de2 100644 --- a/sigi/apps/diagnosticos/models.py +++ b/sigi/apps/diagnosticos/models.py @@ -65,6 +65,7 @@ class Pergunta(BaseSchema): """ categoria = models.ForeignKey(Categoria) class Meta: + ordering = ('title',) verbose_name, verbose_name_plural = 'pergunta', 'perguntas' class Escolha(BaseChoice): diff --git a/sigi/sites.py b/sigi/sites.py index 0b48749..c5041bb 100644 --- a/sigi/sites.py +++ b/sigi/sites.py @@ -24,7 +24,7 @@ from sigi.apps.mesas.admin import (Legislatura, LegislaturaAdmin, Coligacao, from sigi.apps.parlamentares.admin import (Partido, PartidoAdmin, Parlamentar, ParlamentarAdmin, Mandato, MandatoAdmin) from sigi.apps.diagnosticos.admin import (Diagnostico, DiagnosticoAdmin, Pergunta, - PerguntaAdmin, Escolha, Anexo as AnexoDiagnostico, + PerguntaAdmin, Escolha, EscolhaAdmin, Anexo as AnexoDiagnostico, AnexoAdmin as AnexoDiagnosticoAdmin, Categoria as CategoriaDiagnostico) from sigi.apps.servidores.admin import (Servidor, ServidorAdmin, Funcao, FuncaoAdmin, @@ -95,7 +95,7 @@ default.register(Mandato, MandatoAdmin) # sigi.apps.diagnosticos default.register(Diagnostico, DiagnosticoAdmin) default.register(Pergunta, PerguntaAdmin) -default.register(Escolha) +default.register(Escolha, EscolhaAdmin) default.register(AnexoDiagnostico, AnexoDiagnosticoAdmin) default.register(CategoriaDiagnostico)