From 0522d85cf52a0d88467eb5fb9419c218f1c7f2c2 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Fri, 2 Oct 2015 14:32:03 -0300 Subject: [PATCH] Change painel URL and style buttons of controller --- painel/urls.py | 17 ++++++++--------- painel/views.py | 20 ++++++-------------- templates/painel/controller.html | 6 +++--- templates/painel/index.html | 3 +-- templates/sessao/painel.html | 12 ++++++------ 5 files changed, 24 insertions(+), 34 deletions(-) diff --git a/painel/urls.py b/painel/urls.py index 5ed106cb4..563c00df4 100644 --- a/painel/urls.py +++ b/painel/urls.py @@ -1,19 +1,18 @@ from django.conf.urls import include, url -from .views import (controlador_painel, cronometro_painel_crud, json_presenca, +from .views import (controlador_painel, cronometro_painel_crud, json_votacao, painel_mensagem_view, painel_parlamentares_view, painel_view, painel_votacao_view) urlpatterns = [ - url(r'^sistema/painel$', painel_view), - url(r'^sistema/painel/controlador', + url(r'^painel$', painel_view, name="painel"), + url(r'^painel/controlador', controlador_painel, name='controlador_painel'), - url(r'^sistema/painel/mensagem', painel_mensagem_view), - url(r'^sistema/painel/parlamentares', painel_parlamentares_view), - url(r'^sistema/painel/votacao', painel_votacao_view), - url(r'^sistema/painel/json_presenca', json_presenca, name='json_presenca'), - url(r'^sistema/painel/json_votacao', json_votacao, name='json_votacao'), - url(r'^sistema/painel/cronometro', + url(r'^painel/mensagem', painel_mensagem_view), + url(r'^painel/parlamentares', painel_parlamentares_view), + url(r'^painel/votacao', painel_votacao_view), + url(r'^painel/(?P\d+)/json_votacao$', json_votacao, name='json_votacao'), + url(r'^painel/cronometro', include(cronometro_painel_crud.urls)), ] diff --git a/painel/views.py b/painel/views.py index ab7ae95cd..cb7d4c930 100644 --- a/painel/views.py +++ b/painel/views.py @@ -51,7 +51,7 @@ def cronometro_painel(request): return HttpResponse({}) -def painel_view(request): +def painel_view(request, pk): context = {'head_title': 'Painel Plenário', 'title': '3a. Sessao Ordinária do Município XYZ'} return render(request, 'painel/index.html', {'context': context}) @@ -70,23 +70,15 @@ def painel_votacao_view(request): # REST web services - -def json_presenca(request): - presencas = PresencaOrdemDia.objects.filter(sessao_plenaria_id=6) - parlamentares = [] - for p in presencas: - parlamentares.append(p.parlamentar) - # parlamentares = serializers.serialize('json', Parlamentar.objects.all()) - parlamentares = serializers.serialize('json', parlamentares) - return HttpResponse(parlamentares, content_type='application/json') - # return JsonResponse(data) # work with python dict - - # TODO: make this response non cacheable, # probably on jQuery site, but check Django too # TODO: reduce number of database query hits by means # of QuerySet wizardry. -def json_votacao(request): + + +def json_votacao(request, pk): + + # TODO: se tentar usar objects.get(ordem_id = 104 # ocorre a msg: 'RegistroVotacao' object does not support indexing # TODO; tratar o caso de vir vazio diff --git a/templates/painel/controller.html b/templates/painel/controller.html index 7675303c1..f4aaabc00 100644 --- a/templates/painel/controller.html +++ b/templates/painel/controller.html @@ -17,8 +17,8 @@ FECHADO
{% endfor %}
- - - + + + {% endblock %} diff --git a/templates/painel/index.html b/templates/painel/index.html index 9158fa75d..6027fd6cf 100644 --- a/templates/painel/index.html +++ b/templates/painel/index.html @@ -96,8 +96,7 @@

{{ context.title }}

- - +

Ajax refresh counter:



diff --git a/templates/sessao/painel.html b/templates/sessao/painel.html index 9be570af7..4ea732d73 100644 --- a/templates/sessao/painel.html +++ b/templates/sessao/painel.html @@ -6,12 +6,12 @@

Operação do Painel Eletrônico