Browse Source

Fix query last materia in painel

pull/202/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
parent
commit
066fadf75d
  1. 8
      painel/views.py

8
painel/views.py

@ -78,7 +78,7 @@ def get_cronometro_status(request, name):
def get_materia_aberta(pk): def get_materia_aberta(pk):
try: try:
materia = OrdemDia.objects.filter( materia = OrdemDia.objects.filter(
sessao_plenaria_id=pk, votacao_aberta=True).first() sessao_plenaria_id=pk, votacao_aberta=True).last()
return materia return materia
except ObjectDoesNotExist: except ObjectDoesNotExist:
return False return False
@ -87,7 +87,7 @@ def get_materia_aberta(pk):
def get_last_materia(pk): def get_last_materia(pk):
try: try:
materia = OrdemDia.objects.filter( materia = OrdemDia.objects.filter(
sessao_plenaria_id=pk).order_by('-data_ordem').first() sessao_plenaria_id=pk).last()
return materia return materia
except ObjectDoesNotExist: except ObjectDoesNotExist:
return None return None
@ -158,7 +158,7 @@ def get_presentes(pk, response, materia):
def get_materia_expediente_aberta(pk): def get_materia_expediente_aberta(pk):
try: try:
materia = ExpedienteMateria.objects.filter( materia = ExpedienteMateria.objects.filter(
sessao_plenaria_id=pk, votacao_aberta=True).first() sessao_plenaria_id=pk, votacao_aberta=True).last()
return materia return materia
except ObjectDoesNotExist: except ObjectDoesNotExist:
return False return False
@ -167,7 +167,7 @@ def get_materia_expediente_aberta(pk):
def get_last_materia_expediente(pk): def get_last_materia_expediente(pk):
try: try:
materia = ExpedienteMateria.objects.filter( materia = ExpedienteMateria.objects.filter(
sessao_plenaria_id=pk).order_by('-data_ordem').first() sessao_plenaria_id=pk).last()
return materia return materia
except ObjectDoesNotExist: except ObjectDoesNotExist:
return None return None

Loading…
Cancel
Save