Browse Source

Correcao de bug no search da app ocorrencias

producao
Breno Teixeira 11 years ago
parent
commit
a427a835ef
  1. 11
      sigi/apps/ocorrencias/admin.py
  2. 4
      sigi/apps/ocorrencias/models.py

11
sigi/apps/ocorrencias/admin.py

@ -1,9 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.contrib import admin from django.contrib import admin
from django.contrib.admin.views.main import ChangeList from django.contrib.admin.views.main import ChangeList
from eav.admin import BaseEntityAdmin, BaseSchemaAdmin
from sigi.apps.servidores.models import Servidor from sigi.apps.servidores.models import Servidor
from sigi.apps.ocorrencias.models import Ocorrencia, Comentario, Anexo, Categoria, TipoContato from sigi.apps.ocorrencias.models import Ocorrencia, Comentario, Anexo, Categoria, TipoContato
@ -23,7 +21,8 @@ class ComentarioInline(admin.StackedInline):
extra = 1 extra = 1
verbose_name, verbose_name_plural = u"Comentário novo", u"Comentários novos" verbose_name, verbose_name_plural = u"Comentário novo", u"Comentários novos"
fieldsets = ((None, {'fields': (('novo_status', 'encaminhar_setor',), 'descricao', )}),) fieldsets = ((None, {'fields': (('novo_status', 'encaminhar_setor',), 'descricao', )}),)
def queryset(self, request):
def queryset(self, queryset):
return self.model.objects.get_query_set() return self.model.objects.get_query_set()
@ -35,12 +34,14 @@ class AnexosInline(admin.TabularInline):
class OcorrenciaChangeList(ChangeList): class OcorrenciaChangeList(ChangeList):
request = None request = None
def __init__(self, request, model, list_display, list_display_links, list_filter, date_hierarchy, search_fields, def __init__(self, request, model, list_display, list_display_links, list_filter, date_hierarchy, search_fields,
list_select_related, list_per_page, list_max_show_all, list_editable, model_admin): list_select_related, list_per_page, list_max_show_all, list_editable, model_admin):
self.request = request self.request = request
super(OcorrenciaChangeList, self).__init__(request, model, list_display, list_display_links, list_filter, super(OcorrenciaChangeList, self).__init__(request, model, list_display, list_display_links, list_filter,
date_hierarchy, search_fields, list_select_related, list_per_page, date_hierarchy, search_fields, list_select_related, list_per_page,
list_max_show_all, list_editable, model_admin) list_max_show_all, list_editable, model_admin)
def get_query_set(self, request): def get_query_set(self, request):
tmp_params = self.params.copy() tmp_params = self.params.copy()
grupo = None grupo = None
@ -61,7 +62,7 @@ class OcorrenciaChangeList(ChangeList):
class OcorrenciaAdmin(admin.ModelAdmin): class OcorrenciaAdmin(admin.ModelAdmin):
list_display = ('data_criacao', 'casa_legislativa', 'assunto', 'prioridade', 'status', 'data_modificacao', 'setor_responsavel',) list_display = ('data_criacao', 'casa_legislativa', 'assunto', 'prioridade', 'status', 'data_modificacao', 'setor_responsavel',)
list_filter = ('categoria__nome', 'assunto', 'status', 'prioridade', 'setor_responsavel__nome', ) list_filter = ('categoria__nome', 'assunto', 'status', 'prioridade', 'setor_responsavel__nome', )
search_fields = ('casa_legislativa__search_text', 'assunto', 'servidor_registro__nome', ) search_fields = ('casa_legislativa__search_text', 'assunto', 'servidor_registro__nome_completo', )
date_hierarchy = 'data_criacao' date_hierarchy = 'data_criacao'
fields = ('casa_legislativa', 'categoria', 'tipo_contato', 'assunto', 'status', 'prioridade', 'descricao', 'servidor_registro', fields = ('casa_legislativa', 'categoria', 'tipo_contato', 'assunto', 'status', 'prioridade', 'descricao', 'servidor_registro',
'setor_responsavel', 'resolucao', ) 'setor_responsavel', 'resolucao', )

4
sigi/apps/ocorrencias/models.py

@ -1,9 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.db import models from django.db import models
from datetime import datetime
from django.db import models
from sigi.apps.utils import SearchField
#from eav.models import BaseChoice, BaseEntity, BaseSchema, BaseAttribute
class Categoria(models.Model): class Categoria(models.Model):

Loading…
Cancel
Save