diff --git a/sapl/parlamentares/urls.py b/sapl/parlamentares/urls.py index b062ab54b..30c9eacb6 100644 --- a/sapl/parlamentares/urls.py +++ b/sapl/parlamentares/urls.py @@ -1,6 +1,7 @@ from django.conf.urls import include, url from sapl.parlamentares.views import (CargoMesaCrud, ColigacaoCrud, + coligacao_legislatura, ComposicaoColigacaoCrud, DependenteCrud, BancadaCrud, CargoBancadaCrud, FiliacaoCrud, FrenteCrud, FrenteList, @@ -60,6 +61,9 @@ urlpatterns = [ url(r'^parlamentar/vincular-parlamentar/$', VincularParlamentarView.as_view(), name='vincular_parlamentar'), + url(r'^parlamentar/coligacao-legislatura/', + coligacao_legislatura, name="coligacao_legislatura"), + url(r'^sistema/coligacao/', include(ColigacaoCrud.get_urls() + ComposicaoColigacaoCrud.get_urls())), diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index f82dd7867..233f1369b 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -332,6 +332,17 @@ class ColigacaoCrud(CrudAux): return context +def coligacao_legislatura(request): + try: + coligacoes = Coligacao.objects.filter(legislatura=request.GET['legislatura']).order_by('nome') + except: + coligacoes = [] + + lista_coligacoes = [(coligacao.id, str(coligacao)) for coligacao in coligacoes] + + return JsonResponse({'coligacoes': lista_coligacoes}) + + def json_date_convert(date): """ :param date: recebe a data de uma chamada ajax no formato de diff --git a/sapl/templates/parlamentares/mandato_form.html b/sapl/templates/parlamentares/mandato_form.html new file mode 100644 index 000000000..fc658a7e8 --- /dev/null +++ b/sapl/templates/parlamentares/mandato_form.html @@ -0,0 +1,41 @@ +{% extends "crud/form.html" %} +{% load i18n %} +{% load crispy_forms_tags %} +{% load common_tags %} + +{% block extra_js %} + +{% endblock %}