Browse Source

Ref List da aba Proposições para parlamentares

pull/739/head
LeandroRoberto 8 years ago
parent
commit
e452084af9
  1. 1
      requirements/requirements.txt
  2. 8
      sapl/api/urls.py
  3. 6
      sapl/protocoloadm/forms.py
  4. 3
      sapl/protocoloadm/models.py
  5. 8
      sapl/protocoloadm/urls.py
  6. 14
      sapl/protocoloadm/views.py
  7. 12
      sapl/relatorios/views.py
  8. 6
      sapl/settings.py
  9. 4
      sapl/static/js/app.js
  10. 2
      sapl/static/styles/app.scss
  11. 10
      sapl/test_urls.py

1
requirements/requirements.txt

@ -13,6 +13,7 @@ django-floppyforms==1.6.2
django-model-utils==2.5
django-sass-processor==0.4.6
djangorestframework
drfdocs
easy-thumbnails==2.3
git+git://github.com/interlegis/trml2pdf.git
libsass==0.11.1

8
sapl/api/urls.py

@ -1,4 +1,6 @@
from django.conf import settings
from django.conf.urls import url, include
from sapl.api.views import AutorListView
from .apps import AppConfig
@ -17,8 +19,12 @@ urlpatterns_api = [
url(r'^autor',
AutorListView.as_view(),
name='autor_list'),
url(r'^docs', include('rest_framework_docs.urls')),
]
if settings.DEBUG:
urlpatterns_api += [
url(r'^docs', include('rest_framework_docs.urls')), ]
urlpatterns = [
url(r'^api/', include(urlpatterns_api))
]

6
sapl/protocoloadm/forms.py

@ -1,6 +1,5 @@
from datetime import datetime
import django_filters
from crispy_forms.bootstrap import InlineRadios
from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Button, Fieldset, Layout, Submit
@ -9,9 +8,11 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _
import django_filters
from sapl.base.models import Autor
from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.materia.models import Autor, UnidadeTramitacao
from sapl.materia.models import UnidadeTramitacao
from sapl.utils import (RANGE_ANOS, RangeWidgetOverride, autor_label,
autor_modal)
@ -19,6 +20,7 @@ from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo,
Protocolo, TipoDocumentoAdministrativo,
TramitacaoAdministrativo)
TIPOS_PROTOCOLO = [('0', 'Enviado'), ('1', 'Recebido'), ('', 'Ambos')]
NATUREZA_PROCESSO = [('', 'Ambos'),

3
sapl/protocoloadm/models.py

@ -4,7 +4,8 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
from sapl.materia.models import (Autor, TipoMateriaLegislativa,
from sapl.base.models import Autor
from sapl.materia.models import (TipoMateriaLegislativa,
UnidadeTramitacao)
from sapl.utils import RANGE_ANOS, YES_NO_CHOICES

8
sapl/protocoloadm/urls.py

@ -17,7 +17,7 @@ from sapl.protocoloadm.views import (AnularProtocoloAdmView,
ProtocoloPesquisaView,
StatusTramitacaoAdministrativoCrud,
TipoDocumentoAdministrativoCrud,
TramitacaoAdmCrud, pesquisa_autores)
TramitacaoAdmCrud)
from .apps import AppConfig
@ -70,11 +70,11 @@ urlpatterns_sistema = [
url(r'^sistema/status-tramitacao-adm/',
include(StatusTramitacaoAdministrativoCrud.get_urls())),
# FIXME: Usado para pesquisar autor
# FIXME: Usado para pesquisar autor- SOLUÇÃO-foi transformado em api/autor
# Melhor forma de fazer?
# Deve mudar de app?
url(r'^protocoloadm/pesquisar-autor',
pesquisa_autores, name='pesquisar_autor'),
# url(r'^protocoloadm/pesquisar-autor',
# pesquisa_autores, name='pesquisar_autor'),
]
urlpatterns = (urlpatterns_documento_administrativo +

14
sapl/protocoloadm/views.py

@ -15,7 +15,7 @@ from django.views.generic.base import TemplateView
from django_filters.views import FilterView
from sapl.base.apps import AppConfig as AppsAppConfig
from sapl.base.models import AppConfig
from sapl.base.models import AppConfig, Autor
from sapl.crud.base import Crud, CrudAux, MasterDetailCrud, make_pagination
from sapl.materia.models import TipoMateriaLegislativa
from sapl.utils import (create_barcode, get_client_ip, permissoes_adm,
@ -26,7 +26,7 @@ from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm,
DocumentoAdministrativoForm, ProtocoloDocumentForm,
ProtocoloFilterSet, ProtocoloMateriaForm,
TramitacaoAdmEditForm, TramitacaoAdmForm)
from .models import (Autor, DocumentoAcessorioAdministrativo,
from .models import (DocumentoAcessorioAdministrativo,
DocumentoAdministrativo, Protocolo,
StatusTramitacaoAdministrativo,
TipoDocumentoAdministrativo, TramitacaoAdministrativo)
@ -585,6 +585,7 @@ class TramitacaoAdmCrud(MasterDetailCrud):
pass
"""
def get_nome_autor(request):
nome_autor = ''
if request.method == 'GET':
@ -598,19 +599,19 @@ def get_nome_autor(request):
except ObjectDoesNotExist:
pass
return HttpResponse("{\"nome\":\"" + nome_autor + "\"}",
content_type="application/json; charset=utf-8")
content_type="application/json; charset=utf-8")"""
"""
def pesquisa_autores(request):
q = ''
if request.method == 'GET':
q = request.GET.get('q', '')
"""autor = Autor.objects.filter(
autor = Autor.objects.filter(
Q(nome__icontains=q) |
Q(parlamentar__nome_parlamentar__icontains=q) |
Q(comissao__nome__icontains=q)
)"""
)
autor = Autor.objects.filter(nome__icontains=q)
@ -633,3 +634,4 @@ def pesquisa_autores(request):
sort_keys=True,
ensure_ascii=False),
content_type="application/json; charset=utf-8")
"""

12
sapl/relatorios/views.py

@ -4,9 +4,9 @@ from bs4 import BeautifulSoup
from django.http import Http404, HttpResponse
from django.utils.translation import ugettext_lazy as _
from sapl.base.models import CasaLegislativa
from sapl.base.models import CasaLegislativa, Autor
from sapl.comissoes.models import Comissao
from sapl.materia.models import (Autor, Autoria, MateriaLegislativa, Numeracao,
from sapl.materia.models import (Autoria, MateriaLegislativa, Numeracao,
Tramitacao, UnidadeTramitacao)
from sapl.parlamentares.models import (CargoMesa, ComposicaoMesa, Filiacao,
Parlamentar)
@ -102,12 +102,8 @@ def get_materias(mats):
dic['txt_ementa'] = materia.ementa
autores = Autoria.objects.filter(materia=materia)
dic['nom_autor'] = " "
for autoria in autores:
if autoria.autor.parlamentar:
dic['nom_autor'] = autoria.autor.parlamentar.nome_completo
elif autoria.autor.comissao:
dic['nom_autor'] = autoria.autor.comissao.nome
dic['nom_autor'] = ', '.join(
[str(autoria.autor) for autoria in autores])
des_status = ''
txt_tramitacao = ''

6
sapl/settings.py

@ -75,12 +75,12 @@ INSTALLED_APPS = (
'floppyforms',
'sass_processor',
'rest_framework',
'rest_framework_docs',
) + SAPL_APPS
# if DEBUG:
# INSTALLED_APPS += ('debug_toolbar',)
if DEBUG:
INSTALLED_APPS += ('debug_toolbar', 'rest_framework_docs',)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',

4
sapl/static/js/app.js

@ -135,7 +135,7 @@ function autorModal() {
});
});
function get_nome_autor(fieldname) {
/*function get_nome_autor(fieldname) {
if ($(fieldname).length > 0) { // se campo existir
if ($(fieldname).val() != "") { // e não for vazio
var id = $(fieldname).val();
@ -147,7 +147,7 @@ function autorModal() {
}
get_nome_autor("#id_autor");
get_nome_autor("#id_autoria__autor");
get_nome_autor("#id_autoria__autor");*/
}
$(document).ready(function(){

2
sapl/static/styles/app.scss

@ -43,7 +43,7 @@ nav {
.masthead {
padding: 10px;
.nav {
margin-top: 65px;
clear:both;
}
.navbar-brand {
color: $headings-color;

10
sapl/test_urls.py

@ -1,4 +1,3 @@
import pytest
from django.apps import apps
from django.contrib.auth import get_user_model
from django.contrib.auth.management import _get_all_permissions
@ -6,8 +5,9 @@ from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.db import transaction
from django.utils.translation import string_concat
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat
from django.utils.translation import ugettext_lazy as _
import pytest
from sapl.crud.base import PermissionRequiredForAppCrudMixin
from sapl.materia.views import recuperar_materia
@ -16,6 +16,7 @@ from scripts.lista_urls import lista_urls
from .settings import SAPL_APPS
pytestmark = pytest.mark.django_db
sapl_appconfs = [apps.get_app_config(n[5:]) for n in SAPL_APPS]
@ -148,6 +149,10 @@ def test_crudaux_list_do_crud_esta_na_pagina_sistema(url_item, admin_client):
""" % (url, app_name)
apps_url_patterns_prefixs_and_users = {
'api': {
'prefixs': [
'/api/',
]},
'base': {
'users': {'operador_geral': ['/sistema']},
'prefixs': [
@ -434,7 +439,6 @@ def test_permissions_urls_for_users_by_apps(url_item, client):
assert app in apps_url_patterns_prefixs_and_users, """
O app_label (%s) associado a url (%s) não está na base de testes.
%s
""" % (app_name, url)
if 'users' not in apps_url_patterns_prefixs_and_users[app]:

Loading…
Cancel
Save