diff --git a/.gitignore b/.gitignore index fcc76b35b..f60f6ed26 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,8 @@ coverage.xml # Django stuff: *.log +*.swp + # Sphinx documentation docs/_build/ diff --git a/painel/__init__.py b/painel/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/painel/admin.py b/painel/admin.py new file mode 100644 index 000000000..8c38f3f3d --- /dev/null +++ b/painel/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/painel/migrations/__init__.py b/painel/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/painel/models.py b/painel/models.py new file mode 100644 index 000000000..71a836239 --- /dev/null +++ b/painel/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/painel/tests.py b/painel/tests.py new file mode 100644 index 000000000..7ce503c2d --- /dev/null +++ b/painel/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/painel/urls.py b/painel/urls.py new file mode 100644 index 000000000..9d1c1bab2 --- /dev/null +++ b/painel/urls.py @@ -0,0 +1,10 @@ +from django.conf.urls import include, url + +from . views import (json_view, painel_view, painel_parlamentares_view, painel_votacao_view) + +urlpatterns = [ + url(r'^sistema/painel$', painel_view), + url(r'^sistema/painel/parlamentares', painel_parlamentares_view), + url(r'^sistema/painel/votacao', painel_votacao_view), + url(r'^sistema/painel/json', json_view, name='json_view'), +] diff --git a/painel/views.py b/painel/views.py new file mode 100644 index 000000000..439ef045d --- /dev/null +++ b/painel/views.py @@ -0,0 +1,28 @@ +from django.shortcuts import render +from django.http import HttpResponse +from django.http import JsonResponse +from django.core import serializers + +import json + +from parlamentares.models import Parlamentar +from sessao.models import PresencaOrdemDia + +def json_view(request): + + #error when trying to retrieve + #print(PresencaOrdemDia.objects.all()) + + parlamentares = serializers.serialize('json', Parlamentar.objects.all()) + return HttpResponse(parlamentares, content_type='application/json') + + #return JsonResponse(data) # work with python dict + +def painel_view(request): + return render(request, 'painel/index.html') + +def painel_parlamentares_view(request): + return render(request, 'painel/parlamentares.html') + +def painel_votacao_view(request): + return render(request, 'painel/votacao.html') diff --git a/sapl/urls.py b/sapl/urls.py index f6af92f69..4ebf95179 100644 --- a/sapl/urls.py +++ b/sapl/urls.py @@ -27,6 +27,7 @@ urlpatterns = [ url(r'', include('materia.urls')), url(r'', include('norma.urls')), url(r'', include('lexml.urls')), + url(r'', include('painel.urls')), # must come at the end # so that base /sistema/ url doesn't capture its children diff --git a/templates/painel/index.html b/templates/painel/index.html new file mode 100644 index 000000000..a4f72e4d4 --- /dev/null +++ b/templates/painel/index.html @@ -0,0 +1,75 @@ + + + + Painel jQuery + + + + + + + + + + + + + + + +

Ajax refresh counter:

+ + + diff --git a/templates/painel/parlamentares.html b/templates/painel/parlamentares.html new file mode 100644 index 000000000..6f046d0d8 --- /dev/null +++ b/templates/painel/parlamentares.html @@ -0,0 +1,49 @@ + + + + Painel jQuery + + + + + + + + + + + + + + + +

+ + diff --git a/templates/painel/votacao.html b/templates/painel/votacao.html new file mode 100644 index 000000000..6f046d0d8 --- /dev/null +++ b/templates/painel/votacao.html @@ -0,0 +1,49 @@ + + + + Painel jQuery + + + + + + + + + + + + + + + +

+ +