Browse Source

List legislaturas from latest to first.

pull/11/merge
Edward Ribeiro 9 years ago
parent
commit
5d839e0c6a
  1. 7
      parlamentares/views.py

7
parlamentares/views.py

@ -147,9 +147,10 @@ class ParlamentaresView(GenericView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
form = ParlamentaresForm() form = ParlamentaresForm()
legislaturas = Legislatura.objects.all().order_by('-data_inicio','-data_fim')
return self.render_to_response( return self.render_to_response(
{'legislaturas': Legislatura.objects.all().order_by('-data_inicio'), {'legislaturas': legislaturas,
'legislatura_id': Legislatura.objects.first().id, 'legislatura_id': legislaturas.first().id,
'mandatos': Mandato.objects.all(), 'mandatos': Mandato.objects.all(),
'form': form, 'form': form,
'filiacao': Filiacao.objects.all()}) 'filiacao': Filiacao.objects.all()})
@ -157,7 +158,7 @@ class ParlamentaresView(GenericView):
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
form = ParlamentaresForm(request.POST) form = ParlamentaresForm(request.POST)
return self.render_to_response( return self.render_to_response(
{'legislaturas': Legislatura.objects.all().order_by('-data_inicio'), {'legislaturas': Legislatura.objects.all().order_by('-data_inicio','-data_fim'),
'legislatura_id': int(form.data['periodo']), 'legislatura_id': int(form.data['periodo']),
'mandatos': Mandato.objects.all(), 'mandatos': Mandato.objects.all(),
'form': form, 'form': form,

Loading…
Cancel
Save