|
@ -114,7 +114,6 @@ class ServicoAtivoFilter(admin.SimpleListFilter): |
|
|
class ServicoAdmin(BaseModelAdmin): |
|
|
class ServicoAdmin(BaseModelAdmin): |
|
|
change_list_template = "servico/change_list.html" |
|
|
change_list_template = "servico/change_list.html" |
|
|
form = ServicoFormAdmin |
|
|
form = ServicoFormAdmin |
|
|
actions = ['calcular_data_uso', ] |
|
|
|
|
|
list_display = ('casa_legislativa', 'get_codigo_interlegis', 'get_uf', 'tipo_servico', 'hospedagem_interlegis', |
|
|
list_display = ('casa_legislativa', 'get_codigo_interlegis', 'get_uf', 'tipo_servico', 'hospedagem_interlegis', |
|
|
'data_ativacao', 'data_desativacao', 'getUrl', 'data_ultimo_uso', 'get_link_erro') |
|
|
'data_ativacao', 'data_desativacao', 'getUrl', 'data_ultimo_uso', 'get_link_erro') |
|
|
fieldsets = ((None, { |
|
|
fieldsets = ((None, { |
|
@ -139,7 +138,7 @@ class ServicoAdmin(BaseModelAdmin): |
|
|
'casa_legislativa__municipio__uf', |
|
|
'casa_legislativa__municipio__uf', |
|
|
) |
|
|
) |
|
|
list_display_links = [] |
|
|
list_display_links = [] |
|
|
actions = ['adicionar_servicos'] |
|
|
actions = ['adicionar_servicos', 'calcular_data_uso', ] |
|
|
ordering = ('casa_legislativa__municipio__uf', 'casa_legislativa', 'tipo_servico',) |
|
|
ordering = ('casa_legislativa__municipio__uf', 'casa_legislativa', 'tipo_servico',) |
|
|
inlines = (LogServicoInline,) |
|
|
inlines = (LogServicoInline,) |
|
|
search_fields = ('casa_legislativa__search_text',) |
|
|
search_fields = ('casa_legislativa__search_text',) |
|
@ -187,7 +186,7 @@ class ServicoAdmin(BaseModelAdmin): |
|
|
return HttpResponseRedirect('.') |
|
|
return HttpResponseRedirect('.') |
|
|
adicionar_servicos.short_description = _(u"Armazenar serviços no carrinho para exportar") |
|
|
adicionar_servicos.short_description = _(u"Armazenar serviços no carrinho para exportar") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def calcular_data_uso(self, request, queryset): |
|
|
def calcular_data_uso(self, request, queryset): |
|
|
for servico in queryset: |
|
|
for servico in queryset: |
|
|
servico.atualiza_data_uso() |
|
|
servico.atualiza_data_uso() |
|
@ -253,7 +252,7 @@ class ServicoAdmin(BaseModelAdmin): |
|
|
obj.casa_legislativa = Orgao.objects.get(pk=id_casa) |
|
|
obj.casa_legislativa = Orgao.objects.get(pk=id_casa) |
|
|
|
|
|
|
|
|
return obj |
|
|
return obj |
|
|
|
|
|
|
|
|
def changelist_view(self, request, extra_context=None): |
|
|
def changelist_view(self, request, extra_context=None): |
|
|
from sigi.apps.convenios.views import normaliza_data |
|
|
from sigi.apps.convenios.views import normaliza_data |
|
|
request.GET._mutable = True |
|
|
request.GET._mutable = True |
|
@ -265,7 +264,7 @@ class ServicoAdmin(BaseModelAdmin): |
|
|
request, |
|
|
request, |
|
|
extra_context={'query_str': '?' + request.META['QUERY_STRING']} |
|
|
extra_context={'query_str': '?' + request.META['QUERY_STRING']} |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def adicionar_servicos(self, request, queryset): |
|
|
def adicionar_servicos(self, request, queryset): |
|
|
if 'carrinho_servicos' in request.session: |
|
|
if 'carrinho_servicos' in request.session: |
|
|
q1 = len(request.session['carrinho_servicos']) |
|
|
q1 = len(request.session['carrinho_servicos']) |
|
|