Browse Source

Correcao de bug no search da app ocorrencias

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

13
sigi/apps/ocorrencias/admin.py

@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.contrib import admin
from django.contrib.admin.views.main import ChangeList
from eav.admin import BaseEntityAdmin, BaseSchemaAdmin
from sigi.apps.servidores.models import Servidor
from sigi.apps.ocorrencias.models import Ocorrencia, Comentario, Anexo, Categoria, TipoContato
@ -11,7 +9,7 @@ from sigi.apps.ocorrencias.models import Ocorrencia, Comentario, Anexo, Categori
class ComentarioViewInline(admin.TabularInline):
model = Comentario
extra = 0
max_num=0
max_num = 0
can_delete = False
verbose_name, verbose_name_plural = u"Comentário anterior", u"Comentários anteriores"
fields = ('usuario', 'data_criacao', 'novo_status', 'encaminhar_setor', 'descricao', )
@ -23,7 +21,8 @@ class ComentarioInline(admin.StackedInline):
extra = 1
verbose_name, verbose_name_plural = u"Comentário novo", u"Comentários novos"
fieldsets = ((None, {'fields': (('novo_status', 'encaminhar_setor',), 'descricao', )}),)
def queryset(self, request):
def queryset(self, queryset):
return self.model.objects.get_query_set()
@ -35,12 +34,14 @@ class AnexosInline(admin.TabularInline):
class OcorrenciaChangeList(ChangeList):
request = None
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):
self.request = request
super(OcorrenciaChangeList, self).__init__(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)
def get_query_set(self, request):
tmp_params = self.params.copy()
grupo = None
@ -61,7 +62,7 @@ class OcorrenciaChangeList(ChangeList):
class OcorrenciaAdmin(admin.ModelAdmin):
list_display = ('data_criacao', 'casa_legislativa', 'assunto', 'prioridade', 'status', 'data_modificacao', 'setor_responsavel',)
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'
fields = ('casa_legislativa', 'categoria', 'tipo_contato', 'assunto', 'status', 'prioridade', 'descricao', 'servidor_registro',
'setor_responsavel', 'resolucao', )

4
sigi/apps/ocorrencias/models.py

@ -1,9 +1,5 @@
# -*- coding: utf-8 -*-
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):

Loading…
Cancel
Save