From 372e0bd5d91130dbc64a4f6ea999b198c5310b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Mon, 29 Jul 2013 11:43:30 -0300 Subject: [PATCH] =?UTF-8?q?Permitir=20altera=C3=A7=C3=A3o=20do=20campo=20s?= =?UTF-8?q?ervico=20na=20classe=20Servidores.servidor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/servidores/admin.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/sigi/apps/servidores/admin.py b/sigi/apps/servidores/admin.py index 0b9f201..362d436 100644 --- a/sigi/apps/servidores/admin.py +++ b/sigi/apps/servidores/admin.py @@ -42,23 +42,13 @@ class TelefonesInline(generic.GenericTabularInline): model = Telefone class ServidorAdmin(admin.ModelAdmin): - def is_active(self, servidor): return servidor.user.is_active - is_active.admin_order_field = 'is_active' + is_active.admin_order_field = 'user__is_active' is_active.boolean = True is_active.short_description = 'ativo' - def queryset(self, request): - qs = super(ServidorAdmin, self).queryset(request) - qs = qs.extra(select={'is_active': """ - SELECT auth_user.is_active - FROM auth_user - WHERE auth_user.id = servidores_servidor.user_id - """}) - return qs - - list_display = ('nome_completo', 'is_active', 'foto', 'servico') + list_display = ('nome_completo', 'is_active', 'foto', 'servico', ) list_filter = ('user', 'sexo', 'servico',) search_fields = ('nome_completo', 'obs', 'apontamentos', 'user__email', 'user__first_name', @@ -72,8 +62,8 @@ class ServidorAdmin(admin.ModelAdmin): ('Cadastro', { 'fields': ('nome_completo', 'foto', 'email_pessoal', 'rg', 'cpf', 'sexo', 'data_nascimento', 'matricula', 'ramal', 'data_nomeacao', 'ato_numero', 'ato_exoneracao') }), - ('Origem', { - 'fields': ('turno', 'de_fora'), + ('Lotação', { + 'fields': ('servico', 'turno', 'de_fora'), }), (u'Observações', { 'fields': ('apontamentos', 'obs'),