Browse Source

fix: ugettext_lazy to gettext_lazy

bump_django
LeandroJatai 6 months ago
parent
commit
4cae976a91
  1. 2
      drfautoapi/drfautoapi.py
  2. 2
      sapl/api/apps.py
  3. 2
      sapl/api/forms.py
  4. 4
      sapl/audiencia/apps.py
  5. 2
      sapl/audiencia/forms.py
  6. 2
      sapl/audiencia/models.py
  7. 2
      sapl/base/admin.py
  8. 2
      sapl/base/apps.py
  9. 2
      sapl/base/email_utils.py
  10. 4
      sapl/base/forms.py
  11. 2
      sapl/base/models.py
  12. 2
      sapl/base/receivers.py
  13. 6
      sapl/base/templatetags/menus.py
  14. 2
      sapl/base/tests/test_form.py
  15. 6
      sapl/base/tests/test_view_base.py
  16. 2
      sapl/base/views.py
  17. 2
      sapl/comissoes/apps.py
  18. 8
      sapl/comissoes/forms.py
  19. 2
      sapl/comissoes/models.py
  20. 20
      sapl/comissoes/views.py
  21. 2
      sapl/compilacao/apps.py
  22. 2
      sapl/compilacao/forms.py
  23. 2
      sapl/compilacao/models.py
  24. 2
      sapl/compilacao/templatetags/compilacao_filters.py
  25. 34
      sapl/compilacao/views.py
  26. 2
      sapl/context_processors.py
  27. 2
      sapl/crud/base.py
  28. 2
      sapl/decorators.py
  29. 2
      sapl/lexml/apps.py
  30. 2
      sapl/lexml/forms.py
  31. 2
      sapl/lexml/models.py
  32. 2
      sapl/materia/apps.py
  33. 2
      sapl/materia/forms.py
  34. 4
      sapl/materia/models.py
  35. 2
      sapl/materia/views.py
  36. 2
      sapl/norma/apps.py
  37. 2
      sapl/norma/forms.py
  38. 2
      sapl/norma/models.py
  39. 2
      sapl/norma/tests/test_norma.py
  40. 2
      sapl/norma/views.py
  41. 2
      sapl/painel/apps.py
  42. 2
      sapl/painel/models.py
  43. 12
      sapl/painel/views.py
  44. 2
      sapl/parlamentares/apps.py
  45. 2
      sapl/parlamentares/forms.py
  46. 2
      sapl/parlamentares/models.py
  47. 4
      sapl/parlamentares/tests/test_parlamentares.py
  48. 2
      sapl/parlamentares/views.py
  49. 2
      sapl/protocoloadm/apps.py
  50. 10
      sapl/protocoloadm/forms.py
  51. 2
      sapl/protocoloadm/models.py
  52. 66
      sapl/protocoloadm/tests/test_protocoloadm.py
  53. 2
      sapl/protocoloadm/views.py
  54. 2
      sapl/redireciona_urls/apps.py
  55. 2
      sapl/relatorios/apps.py
  56. 2
      sapl/relatorios/forms.py
  57. 2
      sapl/relatorios/views.py
  58. 2
      sapl/rules/__init__.py
  59. 2
      sapl/rules/apps.py
  60. 2
      sapl/rules/tests/test_rules.py
  61. 2
      sapl/sessao/apps.py
  62. 2
      sapl/sessao/forms.py
  63. 2
      sapl/sessao/models.py
  64. 2
      sapl/sessao/tests/test_sessao.py
  65. 16
      sapl/sessao/tests/test_sessao_view.py
  66. 2
      sapl/sessao/views.py
  67. 2
      sapl/test_urls.py
  68. 2
      sapl/utils.py

2
drfautoapi/drfautoapi.py

@ -12,7 +12,7 @@ from django.db.models.base import ModelBase
from django.db.models.fields import TextField, CharField from django.db.models.fields import TextField, CharField
from django.db.models.fields.files import FileField from django.db.models.fields.files import FileField
from django.template.defaultfilters import capfirst from django.template.defaultfilters import capfirst
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import django_filters import django_filters
from django_filters.constants import ALL_FIELDS, EMPTY_VALUES from django_filters.constants import ALL_FIELDS, EMPTY_VALUES
from django_filters.filters import CharFilter from django_filters.filters import CharFilter

2
sapl/api/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

2
sapl/api/forms.py

@ -2,7 +2,7 @@ import logging
from django.db.models import Q from django.db.models import Q
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django_filters.filters import CharFilter, DateFilter, ModelChoiceFilter from django_filters.filters import CharFilter, DateFilter, ModelChoiceFilter
from django_filters.filterset import FilterSet from django_filters.filterset import FilterSet
from rest_framework import serializers from rest_framework import serializers

4
sapl/audiencia/apps.py

@ -1,8 +1,8 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):
name = 'sapl.audiencia' name = 'sapl.audiencia'
label = 'audiencia' label = 'audiencia'
verbose_name = _('Audiência Pública') verbose_name = _('Audiência Pública')

2
sapl/audiencia/forms.py

@ -5,7 +5,7 @@ from datetime import datetime
from django import forms from django import forms
from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import transaction from django.db import transaction
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from crispy_forms.layout import Button, Column, Fieldset, HTML, Layout from crispy_forms.layout import Button, Column, Fieldset, HTML, Layout

2
sapl/audiencia/models.py

@ -1,6 +1,6 @@
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_utils import Choices from model_utils import Choices
from sapl.materia.models import MateriaLegislativa from sapl.materia.models import MateriaLegislativa
from sapl.parlamentares.models import (CargoMesa, Parlamentar) from sapl.parlamentares.models import (CargoMesa, Parlamentar)

2
sapl/base/admin.py

@ -1,6 +1,6 @@
from django.contrib import admin from django.contrib import admin
from django.shortcuts import redirect from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from sapl.base.models import AuditLog from sapl.base.models import AuditLog
from sapl.utils import register_all_models_in_admin from sapl.utils import register_all_models_in_admin

2
sapl/base/apps.py

@ -1,6 +1,6 @@
import django import django
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(django.apps.AppConfig): class AppConfig(django.apps.AppConfig):

2
sapl/base/email_utils.py

@ -11,7 +11,7 @@ from sapl.materia.models import AcompanhamentoMateria
from sapl.protocoloadm.models import AcompanhamentoDocumento from sapl.protocoloadm.models import AcompanhamentoDocumento
from sapl.settings import EMAIL_SEND_USER from sapl.settings import EMAIL_SEND_USER
from sapl.utils import mail_service_configured from sapl.utils import mail_service_configured
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
def load_email_templates(templates, context={}): def load_email_templates(templates, context={}):

4
sapl/base/forms.py

@ -16,7 +16,7 @@ from django.db.models import Q
from django.forms import Form, ModelForm from django.forms import Form, ModelForm
from django.utils import timezone from django.utils import timezone
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import django_filters import django_filters
from haystack.forms import ModelSearchForm from haystack.forms import ModelSearchForm
@ -313,7 +313,7 @@ class UserAdminForm(ModelForm):
) )
""" """
if 'email' in data and data['email']: if 'email' in data and data['email']:
duplicidade = get_user_model().objects.filter(email=data['email']) duplicidade = get_user_model().objects.filter(email=data['email'])
if self.instance.id: if self.instance.id:

2
sapl/base/models.py

@ -7,7 +7,7 @@ from django.db import models
from django.db.models.deletion import CASCADE from django.db.models.deletion import CASCADE
from django.db.models.signals import post_migrate from django.db.models.signals import post_migrate
from django.db.utils import DEFAULT_DB_ALIAS from django.db.utils import DEFAULT_DB_ALIAS
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from sapl.utils import (LISTA_DE_UFS, YES_NO_CHOICES, from sapl.utils import (LISTA_DE_UFS, YES_NO_CHOICES,
get_settings_auth_user_model, models_with_gr_for_model) get_settings_auth_user_model, models_with_gr_for_model)

2
sapl/base/receivers.py

@ -14,7 +14,7 @@ from django.db.models.signals import post_delete, post_save, \
from django.db.utils import DEFAULT_DB_ALIAS from django.db.utils import DEFAULT_DB_ALIAS
from django.dispatch import receiver from django.dispatch import receiver
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from sapl.base.email_utils import do_envia_email_tramitacao from sapl.base.email_utils import do_envia_email_tramitacao
from sapl.base.models import AuditLog, TipoAutor, Autor, Metadata from sapl.base.models import AuditLog, TipoAutor, Autor, Metadata

6
sapl/base/templatetags/menus.py

@ -2,7 +2,7 @@ import logging
from django import template from django import template
from django.urls import reverse from django.urls import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import yaml import yaml
@ -145,7 +145,7 @@ def resolve_urls_inplace(menu, pk, rm, context):
Erro na construção do Menu: Erro na construção do Menu:
menu: {} menu: {}
url: {} url: {}
1) Verifique se a url existe 1) Verifique se a url existe
2) Se existe no contexto um desses itens: 2) Se existe no contexto um desses itens:
- context['root_pk'] pk do master - context['root_pk'] pk do master
- context['object'] objeto do master - context['object'] objeto do master
@ -165,7 +165,7 @@ def resolve_urls_inplace(menu, pk, rm, context):
log = """Erro na construção do Menu: log = """Erro na construção do Menu:
menu: {} menu: {}
url: {} url: {}
1) Verifique se a url existe 1) Verifique se a url existe
2) Se existe no contexto um desses itens: 2) Se existe no contexto um desses itens:
- context['root_pk'] pk do master - context['root_pk'] pk do master
- context['object'] objeto do master - context['object'] objeto do master

2
sapl/base/tests/test_form.py

@ -1,5 +1,5 @@
import pytest import pytest
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from sapl.base.forms import CasaLegislativaForm from sapl.base.forms import CasaLegislativaForm

6
sapl/base/tests/test_view_base.py

@ -2,7 +2,7 @@ import pytest
from model_bakery import baker from model_bakery import baker
import datetime import datetime
from django.urls import reverse from django.urls import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_bakery import baker from model_bakery import baker
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
@ -404,7 +404,7 @@ def test_lista_anexados_ciclicas():
sigla="TT", sigla="TT",
descricao="Tipo_Teste" descricao="Tipo_Teste"
) )
documento_a = baker.make( documento_a = baker.make(
DocumentoAdministrativo, DocumentoAdministrativo,
tipo=tipo_documento, tipo=tipo_documento,
@ -550,7 +550,7 @@ def test_lista_anexados_ciclicas():
data_apresentacao="2019-05-08", data_apresentacao="2019-05-08",
regime_tramitacao=regime_tramitacao, regime_tramitacao=regime_tramitacao,
tipo=tipo_materia tipo=tipo_materia
) )
baker.make( baker.make(
Anexada, Anexada,

2
sapl/base/views.py

@ -24,7 +24,7 @@ from django.utils import timezone
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_decode, urlsafe_base64_encode from django.utils.http import urlsafe_base64_decode, urlsafe_base64_encode
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.generic import (FormView, ListView) from django.views.generic import (FormView, ListView)
from django.views.generic.base import RedirectView, TemplateView from django.views.generic.base import RedirectView, TemplateView
from django_filters.views import FilterView from django_filters.views import FilterView

2
sapl/comissoes/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

8
sapl/comissoes/forms.py

@ -9,7 +9,7 @@ from django.core.exceptions import ValidationError
from django.db import transaction from django.db import transaction
from django.db.models import Q from django.db.models import Q
from django.forms import ModelForm from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.utils import timezone from django.utils import timezone
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
@ -443,10 +443,10 @@ class ReuniaoForm(ModelForm):
if upload_pauta: if upload_pauta:
validar_arquivo(upload_pauta, "Pauta da Reunião") validar_arquivo(upload_pauta, "Pauta da Reunião")
if upload_ata: if upload_ata:
validar_arquivo(upload_ata, "Ata da Reunião") validar_arquivo(upload_ata, "Ata da Reunião")
if upload_anexo: if upload_anexo:
validar_arquivo(upload_anexo, "Anexo da Reunião") validar_arquivo(upload_anexo, "Anexo da Reunião")
@ -474,7 +474,7 @@ class PautaReuniaoFilterSet(django_filters.FilterSet):
self.form.helper.form_method = "GET" self.form.helper.form_method = "GET"
self.form.helper.layout = Layout( self.form.helper.layout = Layout(
Fieldset( Fieldset(
_("Pesquisa de Matérias"), row1, row2, _("Pesquisa de Matérias"), row1, row2,
form_actions(label="Pesquisar") form_actions(label="Pesquisar")
) )
) )

2
sapl/comissoes/models.py

@ -1,5 +1,5 @@
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_utils import Choices from model_utils import Choices
from sapl.base.models import Autor from sapl.base.models import Autor

20
sapl/comissoes/views.py

@ -10,7 +10,7 @@ from django.views.generic import CreateView, DeleteView, FormView, ListView
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.edit import FormMixin, UpdateView from django.views.generic.edit import FormMixin, UpdateView
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django_filters.views import FilterView from django_filters.views import FilterView
@ -19,7 +19,7 @@ from sapl.comissoes.apps import AppConfig
from sapl.comissoes.forms import (ComissaoForm, ComposicaoForm, from sapl.comissoes.forms import (ComissaoForm, ComposicaoForm,
DocumentoAcessorioCreateForm, DocumentoAcessorioCreateForm,
DocumentoAcessorioEditForm, DocumentoAcessorioEditForm,
ParticipacaoCreateForm, ParticipacaoCreateForm,
ParticipacaoEditForm, ParticipacaoEditForm,
PautaReuniaoFilterSet, PautaReuniaoForm, PautaReuniaoFilterSet, PautaReuniaoForm,
PeriodoForm, ReuniaoForm) PeriodoForm, ReuniaoForm)
@ -186,7 +186,7 @@ def lista_materias_comissao(comissao_pk):
materias = MateriaEmTramitacao.objects.filter( materias = MateriaEmTramitacao.objects.filter(
tramitacao__unidade_tramitacao_destino__comissao=comissao_pk tramitacao__unidade_tramitacao_destino__comissao=comissao_pk
).order_by('materia__tipo', '-materia__ano', '-materia__numero') ).order_by('materia__tipo', '-materia__ano', '-materia__numero')
return materias return materias
@ -229,14 +229,14 @@ class ReuniaoCrud(MasterDetailCrud):
mats = [] mats = []
materias_pauta = PautaReuniao.objects.filter(reuniao=self.kwargs['pk']) materias_pauta = PautaReuniao.objects.filter(reuniao=self.kwargs['pk'])
materias_pk = [materia_pauta.materia.pk for materia_pauta in materias_pauta] materias_pk = [materia_pauta.materia.pk for materia_pauta in materias_pauta]
context['mats'] = MateriaLegislativa.objects.filter( context['mats'] = MateriaLegislativa.objects.filter(
pk__in=materias_pk pk__in=materias_pk
).order_by('tipo', '-ano', 'numero') ).order_by('tipo', '-ano', 'numero')
context['num_mats'] = len(context['mats']) context['num_mats'] = len(context['mats'])
context['reuniao_pk'] = self.kwargs['pk'] context['reuniao_pk'] = self.kwargs['pk']
return context return context
class ListView(MasterDetailCrud.ListView): class ListView(MasterDetailCrud.ListView):
@ -307,7 +307,7 @@ class RemovePautaView(PermissionRequiredMixin, CreateView):
materias_pauta = PautaReuniao.objects.filter(reuniao=context['object']) materias_pauta = PautaReuniao.objects.filter(reuniao=context['object'])
materias_pk = [materia_pauta.materia.pk for materia_pauta in materias_pauta] materias_pk = [materia_pauta.materia.pk for materia_pauta in materias_pauta]
context['materias'] = MateriaLegislativa.objects.filter( context['materias'] = MateriaLegislativa.objects.filter(
pk__in=materias_pk pk__in=materias_pk
).order_by('tipo', '-ano', 'numero') ).order_by('tipo', '-ano', 'numero')
@ -366,16 +366,16 @@ class AdicionaPautaView(PermissionRequiredMixin, FilterView):
context['show_results'] = show_results_filter_set(qr) context['show_results'] = show_results_filter_set(qr)
return context return context
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
success_url = reverse('sapl.comissoes:reuniao_detail', kwargs={'pk':kwargs['pk']}) success_url = reverse('sapl.comissoes:reuniao_detail', kwargs={'pk':kwargs['pk']})
marcadas = request.POST.getlist('materia_id') marcadas = request.POST.getlist('materia_id')
if not marcadas: if not marcadas:
msg = _('Nenhuma máteria foi selecionada.') msg = _('Nenhuma máteria foi selecionada.')
messages.add_message(request, messages.WARNING, msg) messages.add_message(request, messages.WARNING, msg)
return HttpResponseRedirect(success_url) return HttpResponseRedirect(success_url)
reuniao = Reuniao.objects.get(pk=kwargs['pk']) reuniao = Reuniao.objects.get(pk=kwargs['pk'])
pautas = [] pautas = []
for materia in MateriaLegislativa.objects.filter(id__in=marcadas): for materia in MateriaLegislativa.objects.filter(id__in=marcadas):
@ -384,7 +384,7 @@ class AdicionaPautaView(PermissionRequiredMixin, FilterView):
pauta.materia = materia pauta.materia = materia
pautas.append(pauta) pautas.append(pauta)
PautaReuniao.objects.bulk_create(pautas) PautaReuniao.objects.bulk_create(pautas)
msg = _('Matéria(s) adicionada(s) com sucesso!') msg = _('Matéria(s) adicionada(s) com sucesso!')
messages.add_message(request, messages.SUCCESS, msg) messages.add_message(request, messages.SUCCESS, msg)
return HttpResponseRedirect(success_url) return HttpResponseRedirect(success_url)

2
sapl/compilacao/apps.py

@ -3,7 +3,7 @@ from django import apps
from django.conf import settings from django.conf import settings
from django.db import connection, models from django.db import connection, models
from django.db.utils import DEFAULT_DB_ALIAS, IntegrityError from django.db.utils import DEFAULT_DB_ALIAS, IntegrityError
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

2
sapl/compilacao/forms.py

@ -12,7 +12,7 @@ from django.forms import widgets
from django.forms.forms import Form from django.forms.forms import Form
from django.forms.models import ModelForm from django.forms.models import ModelForm
from django.template import defaultfilters from django.template import defaultfilters
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from image_cropping.widgets import CropWidget, ImageCropWidget from image_cropping.widgets import CropWidget, ImageCropWidget
from model_utils.choices import Choices from model_utils.choices import Choices

2
sapl/compilacao/models.py

@ -10,7 +10,7 @@ from django.template import defaultfilters
from django.utils import timezone from django.utils import timezone
from django.utils.decorators import classonlymethod from django.utils.decorators import classonlymethod
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from image_cropping.fields import ImageCropField, ImageRatioField from image_cropping.fields import ImageCropField, ImageRatioField
from sapl.compilacao.utils import (get_integrations_view_names, int_to_letter, from sapl.compilacao.utils import (get_integrations_view_names, int_to_letter,

2
sapl/compilacao/templatetags/compilacao_filters.py

@ -3,7 +3,7 @@ from django import template
from django.core.signing import Signer from django.core.signing import Signer
from django.db.models import Q from django.db.models import Q
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from sapl.compilacao.models import Dispositivo from sapl.compilacao.models import Dispositivo

34
sapl/compilacao/views.py

@ -22,7 +22,7 @@ from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.utils.dateparse import parse_date from django.utils.dateparse import parse_date
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from django.views.generic.edit import (CreateView, DeleteView, FormView, from django.views.generic.edit import (CreateView, DeleteView, FormView,
@ -1956,7 +1956,7 @@ class ActionDeleteDispositivoMixin(ActionsCommonsMixin):
continua internos extra bloco. continua internos extra bloco.
Depois do bloco limpo, a função é chamada novamente para Depois do bloco limpo, a função é chamada novamente para
excluir realmente a escolha do usuário excluir realmente a escolha do usuário
e religar seus irmaos e religar seus irmaos
""" """
self.remover_dispositivo(base, False) self.remover_dispositivo(base, False)
@ -3225,14 +3225,14 @@ class DispositivoSearchFragmentFormView(ListView):
AND_CONTROLS = 'AND td.dispositivo_de_alteracao = false' AND_CONTROLS = 'AND td.dispositivo_de_alteracao = false'
else: else:
if df == 'alterador': if df == 'alterador':
AND_CONTROLS = '''AND td.dispositivo_de_alteracao = true AND_CONTROLS = '''AND td.dispositivo_de_alteracao = true
AND td.dispositivo_de_articulacao = true''' AND td.dispositivo_de_articulacao = true'''
texto = list(map("d.texto ~* '{}'".format, texto)) texto = list(map("d.texto ~* '{}'".format, texto))
AND_TEXTO_ROTULO = '' AND_TEXTO_ROTULO = ''
if str_texto and rotulo: if str_texto and rotulo:
AND_TEXTO_ROTULO = '''AND ( ({BUSCA_TEXTO} AND d.rotulo ~* '{BUSCA_ROTULO}') OR AND_TEXTO_ROTULO = '''AND ( ({BUSCA_TEXTO} AND d.rotulo ~* '{BUSCA_ROTULO}') OR
({BUSCA_TEXTO} AND d.rotulo = '' AND dp.rotulo ~* '{BUSCA_ROTULO}') ({BUSCA_TEXTO} AND d.rotulo = '' AND dp.rotulo ~* '{BUSCA_ROTULO}')
)'''.format( )'''.format(
BUSCA_TEXTO=' AND '.join(texto), BUSCA_TEXTO=' AND '.join(texto),
BUSCA_ROTULO=rotulo BUSCA_ROTULO=rotulo
@ -3255,29 +3255,29 @@ class DispositivoSearchFragmentFormView(ListView):
gfk_field_type_id=tipo_model.id, gfk_field_type_id=tipo_model.id,
) )
sql = ''' sql = '''
SELECT d.* FROM compilacao_dispositivo d SELECT d.* FROM compilacao_dispositivo d
JOIN compilacao_dispositivo dp on (d.dispositivo_pai_id = dp.id) JOIN compilacao_dispositivo dp on (d.dispositivo_pai_id = dp.id)
JOIN compilacao_tipodispositivo td on (d.tipo_dispositivo_id = td.id) JOIN compilacao_tipodispositivo td on (d.tipo_dispositivo_id = td.id)
JOIN compilacao_textoarticulado ta on (d.ta_id = ta.id) JOIN compilacao_textoarticulado ta on (d.ta_id = ta.id)
{JOIN_TYPE_MODEL_SELECTED} {JOIN_TYPE_MODEL_SELECTED}
where d.nivel > 0 where d.nivel > 0
{AND_TYPE_MODEL_SELECTED} {AND_TYPE_MODEL_SELECTED}
{AND_TEXTO_ROTULO} {AND_TEXTO_ROTULO}
{AND1_NUMERO} {AND1_NUMERO}
{AND2_ANO} {AND2_ANO}
{AND3_TIPO_TA} {AND3_TIPO_TA}
{AND_CONTROLS} {AND_CONTROLS}
order by ta.data desc, order by ta.data desc,
ta.numero desc, ta.numero desc,
ta.id desc, ta.id desc,
d.ordem d.ordem
{limit}; {limit};
'''.format( '''.format(
limit='limit {}'.format(limit) if limit else '', limit='limit {}'.format(limit) if limit else '',

2
sapl/context_processors.py

@ -1,7 +1,7 @@
import logging import logging
from django.conf import settings from django.conf import settings
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from sapl.utils import google_recaptcha_configured as google_recaptcha_configured_utils, sapn_is_enabled from sapl.utils import google_recaptcha_configured as google_recaptcha_configured_utils, sapn_is_enabled
from sapl.utils import mail_service_configured as mail_service_configured_utils from sapl.utils import mail_service_configured as mail_service_configured_utils

2
sapl/crud/base.py

@ -16,7 +16,7 @@ from django.shortcuts import redirect
from django.urls import reverse from django.urls import reverse
from django.utils.decorators import classonlymethod from django.utils.decorators import classonlymethod
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.generic import (CreateView, DeleteView, DetailView, ListView, from django.views.generic import (CreateView, DeleteView, DetailView, ListView,
UpdateView) UpdateView)
from django.views.generic.base import ContextMixin from django.views.generic.base import ContextMixin

2
sapl/decorators.py

@ -1,7 +1,7 @@
from functools import wraps from functools import wraps
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
def vigencia_atual(decorated_method): def vigencia_atual(decorated_method):

2
sapl/lexml/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

2
sapl/lexml/forms.py

@ -1,7 +1,7 @@
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.forms import ModelForm from django.forms import ModelForm
from sapl.settings import PROJECT_DIR from sapl.settings import PROJECT_DIR
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from io import StringIO from io import StringIO
from lxml import etree from lxml import etree

2
sapl/lexml/models.py

@ -1,5 +1,5 @@
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class LexmlProvedor(models.Model): # LexmlRegistroProvedor class LexmlProvedor(models.Model): # LexmlRegistroProvedor

2
sapl/materia/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

2
sapl/materia/forms.py

@ -15,7 +15,7 @@ from django.forms.models import ModelMultipleChoiceField
from django.forms.widgets import CheckboxSelectMultiple, HiddenInput, Select from django.forms.widgets import CheckboxSelectMultiple, HiddenInput, Select
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import django_filters import django_filters
from sapl.base.models import AppConfig as BaseAppConfig, Autor, TipoAutor from sapl.base.models import AppConfig as BaseAppConfig, Autor, TipoAutor

4
sapl/materia/models.py

@ -8,7 +8,7 @@ from django.db import models
from django.db.models.functions import Concat from django.db.models.functions import Concat
from django.template import defaultfilters from django.template import defaultfilters
from django.utils import formats, timezone from django.utils import formats, timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_utils import Choices from model_utils import Choices
from sapl.base.models import SEQUENCIA_NUMERACAO_PROTOCOLO, Autor from sapl.base.models import SEQUENCIA_NUMERACAO_PROTOCOLO, Autor
@ -934,7 +934,7 @@ class Proposicao(models.Model):
""" """
Ao ser recebida, irá gerar uma nova matéria ou um documento acessorio de uma existente Ao ser recebida, irá gerar uma nova matéria ou um documento acessorio de uma existente
materia_gerada = models.ForeignKey( materia_gerada = models.ForeignKey(
MateriaLegislativa, MateriaLegislativa,
blank=True, blank=True,

2
sapl/materia/views.py

@ -25,7 +25,7 @@ from django.template import loader
from django.urls import reverse from django.urls import reverse
from django.utils import formats, timezone from django.utils import formats, timezone
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, ListView, TemplateView, UpdateView from django.views.generic import CreateView, ListView, TemplateView, UpdateView
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView

2
sapl/norma/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

2
sapl/norma/forms.py

@ -7,7 +7,7 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db.models import Q from django.db.models import Q
from django.forms import ModelChoiceField, ModelForm, widgets from django.forms import ModelChoiceField, ModelForm, widgets
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import django_filters import django_filters
from sapl.base.models import TipoAutor from sapl.base.models import TipoAutor

2
sapl/norma/models.py

@ -2,7 +2,7 @@ from django.contrib.contenttypes.fields import GenericRelation
from django.db import models from django.db import models
from django.template import defaultfilters from django.template import defaultfilters
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_utils import Choices from model_utils import Choices
from sapl.base.models import Autor from sapl.base.models import Autor

2
sapl/norma/tests/test_norma.py

@ -1,5 +1,5 @@
from django.urls import reverse from django.urls import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_bakery import baker from model_bakery import baker
import pytest import pytest

2
sapl/norma/views.py

@ -13,7 +13,7 @@ from django.urls import reverse
from django.urls.base import reverse_lazy from django.urls.base import reverse_lazy
from django.utils import timezone from django.utils import timezone
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView, UpdateView from django.views.generic import TemplateView, UpdateView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
from django_filters.views import FilterView from django_filters.views import FilterView

2
sapl/painel/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

2
sapl/painel/models.py

@ -1,5 +1,5 @@
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class Painel(models.Model): class Painel(models.Model):

12
sapl/painel/views.py

@ -11,7 +11,7 @@ from django.http import HttpResponse, JsonResponse
from django.http.response import Http404, HttpResponseRedirect from django.http.response import Http404, HttpResponseRedirect
from django.shortcuts import render from django.shortcuts import render
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from sapl.base.models import AppConfig as ConfiguracoesAplicacao from sapl.base.models import AppConfig as ConfiguracoesAplicacao
from sapl.base.models import CasaLegislativa from sapl.base.models import CasaLegislativa
@ -202,7 +202,7 @@ def can_vote(context, context_vars, request):
def votante_view(request): def votante_view(request):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
username = request.user.username if request.user.is_authenticated else 'AnonymousUser' username = request.user.username if request.user.is_authenticated else 'AnonymousUser'
# Pega o votante relacionado ao usuário # Pega o votante relacionado ao usuário
template_name = 'painel/voto_nominal.html' template_name = 'painel/voto_nominal.html'
context = {} context = {}
@ -215,7 +215,7 @@ def votante_view(request):
else: else:
raise ObjectDoesNotExist raise ObjectDoesNotExist
except ObjectDoesNotExist: except ObjectDoesNotExist:
logger.error(f"user={username}. Usuário (user={request.user}) não cadastrado como votante na tela de parlamentares. " logger.error(f"user={username}. Usuário (user={request.user}) não cadastrado como votante na tela de parlamentares. "
"Contate a administração de sua Casa Legislativa!") "Contate a administração de sua Casa Legislativa!")
msg = _("Usuário não cadastrado como votante na tela de parlamentares. Contate a administração de sua Casa Legislativa!") msg = _("Usuário não cadastrado como votante na tela de parlamentares. Contate a administração de sua Casa Legislativa!")
context.update({'error_message': msg}) context.update({'error_message': msg})
@ -365,7 +365,7 @@ def get_presentes(pk, response, materia):
else: else:
presentes = SessaoPlenariaPresenca.objects.filter( presentes = SessaoPlenariaPresenca.objects.filter(
sessao_plenaria_id=pk) sessao_plenaria_id=pk)
sessao = SessaoPlenaria.objects.get(id=pk) sessao = SessaoPlenaria.objects.get(id=pk)
num_presentes = len(presentes) num_presentes = len(presentes)
data_sessao = sessao.data_inicio data_sessao = sessao.data_inicio
@ -555,7 +555,7 @@ def get_dados_painel(request, pk):
if casa and app_config and (bool(casa.logotipo)): if casa and app_config and (bool(casa.logotipo)):
brasao = casa.logotipo.url \ brasao = casa.logotipo.url \
if app_config.mostrar_brasao_painel else None if app_config.mostrar_brasao_painel else None
response = { response = {
'sessao_plenaria': str(sessao), 'sessao_plenaria': str(sessao),
'sessao_plenaria_data': sessao.data_inicio.strftime('%d/%m/%Y'), 'sessao_plenaria_data': sessao.data_inicio.strftime('%d/%m/%Y'),
@ -616,7 +616,7 @@ def get_dados_painel(request, pk):
(not ultimo_timestamp and last_expediente_leitura): (not ultimo_timestamp and last_expediente_leitura):
ordem_expediente = last_expediente_leitura.expediente ordem_expediente = last_expediente_leitura.expediente
ultimo_timestamp = last_expediente_leitura.data_hora ultimo_timestamp = last_expediente_leitura.data_hora
if ordem_expediente: if ordem_expediente:
return JsonResponse(get_votos( return JsonResponse(get_votos(
get_presentes(pk, response, ordem_expediente), get_presentes(pk, response, ordem_expediente),

2
sapl/parlamentares/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

2
sapl/parlamentares/forms.py

@ -11,7 +11,7 @@ from django.db import transaction
from django.db.models import Q from django.db.models import Q
from django.forms import ModelForm from django.forms import ModelForm
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import django_filters import django_filters
from image_cropping.widgets import CropWidget, ImageCropWidget from image_cropping.widgets import CropWidget, ImageCropWidget

2
sapl/parlamentares/models.py

@ -1,7 +1,7 @@
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from image_cropping.fields import ImageCropField, ImageRatioField from image_cropping.fields import ImageCropField, ImageRatioField
from model_utils import Choices from model_utils import Choices
from prompt_toolkit.key_binding.bindings.named_commands import self_insert from prompt_toolkit.key_binding.bindings.named_commands import self_insert

4
sapl/parlamentares/tests/test_parlamentares.py

@ -1,6 +1,6 @@
import pytest import pytest
from django.urls import reverse from django.urls import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_bakery import baker from model_bakery import baker
from sapl.parlamentares.forms import FrenteForm, LegislaturaForm, MandatoForm from sapl.parlamentares.forms import FrenteForm, LegislaturaForm, MandatoForm
@ -314,7 +314,7 @@ def test_legislatura_form_numeros_invalidos():
data_inicio='2002-02-01', data_inicio='2002-02-01',
data_fim='2005-12-31', data_fim='2005-12-31',
data_eleicao='2001-11-01') data_eleicao='2001-11-01')
legislatura2 = baker.make(Legislatura, pk=3, legislatura2 = baker.make(Legislatura, pk=3,
numero=3, numero=3,
data_inicio='2008-02-01', data_inicio='2008-02-01',

2
sapl/parlamentares/views.py

@ -16,7 +16,7 @@ from django.templatetags.static import static
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.utils import timezone from django.utils import timezone
from django.utils.datastructures import MultiValueDictKeyError from django.utils.datastructures import MultiValueDictKeyError
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.decorators.clickjacking import xframe_options_exempt from django.views.decorators.clickjacking import xframe_options_exempt
from django.views.generic import FormView from django.views.generic import FormView
from django.views.generic.edit import UpdateView from django.views.generic.edit import UpdateView

2
sapl/protocoloadm/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

10
sapl/protocoloadm/forms.py

@ -11,7 +11,7 @@ from django.db import transaction
from django.db.models import Max from django.db.models import Max
from django.forms import ModelForm from django.forms import ModelForm
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import django_filters import django_filters
from sapl.base.models import Autor, TipoAutor, AppConfig from sapl.base.models import Autor, TipoAutor, AppConfig
@ -388,9 +388,9 @@ class ProtocoloDocumentoForm(ModelForm):
(Div(), 2), (Div(), 2),
(Alert( (Alert(
""" """
Usuário: <strong>{}</strong> - {}<br> Usuário: <strong>{}</strong> - {}<br>
IP: <strong>{}</strong> - {}<br> IP: <strong>{}</strong> - {}<br>
""".format( """.format(
kwargs['initial']['user_data_hora_manual'], kwargs['initial']['user_data_hora_manual'],
Protocolo._meta.get_field( Protocolo._meta.get_field(
@ -570,9 +570,9 @@ class ProtocoloMateriaForm(ModelForm):
(Div(), 2), (Div(), 2),
(Alert( (Alert(
""" """
Usuário: <strong>{}</strong> - {}<br> Usuário: <strong>{}</strong> - {}<br>
IP: <strong>{}</strong> - {}<br> IP: <strong>{}</strong> - {}<br>
""".format( """.format(
kwargs['initial']['user_data_hora_manual'], kwargs['initial']['user_data_hora_manual'],
Protocolo._meta.get_field( Protocolo._meta.get_field(

2
sapl/protocoloadm/models.py

@ -3,7 +3,7 @@ import re
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_utils import Choices from model_utils import Choices
from sapl.base.models import Autor, AppConfig as SaplAppConfig from sapl.base.models import Autor, AppConfig as SaplAppConfig

66
sapl/protocoloadm/tests/test_protocoloadm.py

@ -3,7 +3,7 @@ from datetime import date, timedelta
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_bakery import baker from model_bakery import baker
from urllib.parse import urlencode from urllib.parse import urlencode
import pytest import pytest
@ -170,7 +170,7 @@ def test_create_tramitacao(admin_client):
msg = force_text(_('A origem da nova tramitação deve ser igual ao ' msg = force_text(_('A origem da nova tramitação deve ser igual ao '
'destino da última adicionada!')) 'destino da última adicionada!'))
# Verifica se a origem da nova tramitacao é igual ao destino da última # Verifica se a origem da nova tramitacao é igual ao destino da última
assert msg in response.context_data[ assert msg in response.context_data[
'form'].errors['__all__'] 'form'].errors['__all__']
@ -508,7 +508,7 @@ def test_lista_documentos_anexados():
) )
lista = lista_anexados(documento_principal) lista = lista_anexados(documento_principal)
assert len(lista) == 2 assert len(lista) == 2
assert lista[0] == documento_anexado assert lista[0] == documento_anexado
assert lista[1] == documento_anexado_anexado assert lista[1] == documento_anexado_anexado
@ -534,7 +534,7 @@ def make_unidade_tramitacao(descricao):
return unidade return unidade
@pytest.mark.django_db(transaction=False) @pytest.mark.django_db(transaction=False)
def test_tramitacoes_documentos_anexados(admin_client): def test_tramitacoes_documentos_anexados(admin_client):
@ -636,14 +636,14 @@ def test_tramitacoes_documentos_anexados(admin_client):
# Teste Remoção de Tramitacao # Teste Remoção de Tramitacao
url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete',
kwargs={'pk': tramitacao_principal.pk}) kwargs={'pk': tramitacao_principal.pk})
response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True) response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True)
assert TramitacaoAdministrativo.objects.filter(id=tramitacao_principal.pk).count() == 0 assert TramitacaoAdministrativo.objects.filter(id=tramitacao_principal.pk).count() == 0
assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada.pk).count() == 0 assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada.pk).count() == 0
assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada_anexada.pk).count() == 0 assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada_anexada.pk).count() == 0
# Testes para quando as tramitações das anexadas divergem # Testes para quando as tramitações das anexadas divergem
form = TramitacaoAdmForm(data={}) form = TramitacaoAdmForm(data={})
form.data = {'data_tramitacao':date(2019, 5, 6), form.data = {'data_tramitacao':date(2019, 5, 6),
@ -698,7 +698,7 @@ def test_tramitacoes_documentos_anexados(admin_client):
assert not tramitacao_anexada_anexada.texto == "Testando a alteração" assert not tramitacao_anexada_anexada.texto == "Testando a alteração"
# Removendo a tramitação pricipal, as tramitações anexadas não devem ser removidas, pois divergiram # Removendo a tramitação pricipal, as tramitações anexadas não devem ser removidas, pois divergiram
url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete',
kwargs={'pk': tramitacao_principal.pk}) kwargs={'pk': tramitacao_principal.pk})
response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True) response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True)
assert TramitacaoAdministrativo.objects.filter(id=tramitacao_principal.pk).count() == 0 assert TramitacaoAdministrativo.objects.filter(id=tramitacao_principal.pk).count() == 0
@ -706,7 +706,7 @@ def test_tramitacoes_documentos_anexados(admin_client):
assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada_anexada.pk).count() == 1 assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada_anexada.pk).count() == 1
# Removendo a tramitação anexada, a tramitação anexada à anexada deve ser removida # Removendo a tramitação anexada, a tramitação anexada à anexada deve ser removida
url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete',
kwargs={'pk': tramitacao_anexada.pk}) kwargs={'pk': tramitacao_anexada.pk})
response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True) response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True)
assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada.pk).count() == 0 assert TramitacaoAdministrativo.objects.filter(id=tramitacao_anexada.pk).count() == 0
@ -752,7 +752,7 @@ def test_tramitacoes_documentos_anexados(admin_client):
assert form.is_valid() assert form.is_valid()
tramitacao_anexada = form.save() tramitacao_anexada = form.save()
tramitacao_principal = documento_principal.tramitacaoadministrativo_set.last() tramitacao_principal = documento_principal.tramitacaoadministrativo_set.last()
tramitacao_anexada_anexada = documento_anexado_anexado.tramitacaoadministrativo_set.last() tramitacao_anexada_anexada = documento_anexado_anexado.tramitacaoadministrativo_set.last()
assert documento_principal.tramitacaoadministrativo_set.all().count() == 1 assert documento_principal.tramitacaoadministrativo_set.all().count() == 1
@ -760,7 +760,7 @@ def test_tramitacoes_documentos_anexados(admin_client):
assert not tramitacao_anexada_anexada assert not tramitacao_anexada_anexada
form = TramitacaoAdmEditForm(data={}) form = TramitacaoAdmEditForm(data={})
# Alterando unidade_tramitacao_destino da matéria principal, # Alterando unidade_tramitacao_destino da matéria principal,
# as anexadas não devem ser alteradas # as anexadas não devem ser alteradas
form.data = {'data_tramitacao':tramitacao_principal.data_tramitacao, form.data = {'data_tramitacao':tramitacao_principal.data_tramitacao,
'unidade_tramitacao_local':tramitacao_principal.unidade_tramitacao_local.pk, 'unidade_tramitacao_local':tramitacao_principal.unidade_tramitacao_local.pk,
@ -791,7 +791,7 @@ def test_tramitacoes_documentos_anexados(admin_client):
form.instance = tramitacao_anexada form.instance = tramitacao_anexada
assert form.is_valid() assert form.is_valid()
tramitacao_anexada = form.save() tramitacao_anexada = form.save()
tramitacao_principal = documento_principal.tramitacaoadministrativo_set.last() tramitacao_principal = documento_principal.tramitacaoadministrativo_set.last()
tramitacao_anexada_anexada = documento_anexado_anexado.tramitacaoadministrativo_set.last() tramitacao_anexada_anexada = documento_anexado_anexado.tramitacaoadministrativo_set.last()
@ -801,7 +801,7 @@ def test_tramitacoes_documentos_anexados(admin_client):
assert compara_tramitacoes_doc(tramitacao_anexada, tramitacao_principal) assert compara_tramitacoes_doc(tramitacao_anexada, tramitacao_principal)
# Removendo a tramitação principal, a tramitação anexada não deve ser removida # Removendo a tramitação principal, a tramitação anexada não deve ser removida
url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete', url = reverse('sapl.protocoloadm:tramitacaoadministrativo_delete',
kwargs={'pk': tramitacao_principal.pk}) kwargs={'pk': tramitacao_principal.pk})
response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True) response = admin_client.post(url, {'confirmar':'confirmar'} ,follow=True)
assert TramitacaoAdministrativo.objects.filter(id=tramitacao_principal.pk).count() == 0 assert TramitacaoAdministrativo.objects.filter(id=tramitacao_principal.pk).count() == 0
@ -980,7 +980,7 @@ def test_tramitacao_lote_documentos_views(admin_client):
# Primeira tramitação em lote # Primeira tramitação em lote
response = admin_client.post(url, response = admin_client.post(url,
{'documentos': documentos, {'documentos': documentos,
'data_tramitacao': date(2019, 5, 15), 'data_tramitacao': date(2019, 5, 15),
'unidade_tramitacao_local': unidade_tramitacao_local_1.id, 'unidade_tramitacao_local': unidade_tramitacao_local_1.id,
@ -988,9 +988,9 @@ def test_tramitacao_lote_documentos_views(admin_client):
'status': status.id, 'status': status.id,
'urgente': False, 'urgente': False,
'texto': 'aaaa', 'texto': 'aaaa',
'salvar':'salvar'}, 'salvar':'salvar'},
follow=True) follow=True)
assert response.status_code == 200 assert response.status_code == 200
assert TramitacaoAdministrativo.objects.all().count() == 2 assert TramitacaoAdministrativo.objects.all().count() == 2
@ -1001,10 +1001,10 @@ def test_tramitacao_lote_documentos_views(admin_client):
url_lote = reverse('sapl.protocoloadm:tramitacao_em_lote_docadm') url_lote = reverse('sapl.protocoloadm:tramitacao_em_lote_docadm')
url_lote = url_lote + '?' + urlencode( url_lote = url_lote + '?' + urlencode(
{'tipo':tipo_documento.id, {'tipo':tipo_documento.id,
'tramitacaoadministrativo__unidade_tramitacao_destino':unidade_tramitacao_destino_1.id, 'tramitacaoadministrativo__unidade_tramitacao_destino':unidade_tramitacao_destino_1.id,
'tramitacaoadministrativo__status': status.id, 'tramitacaoadministrativo__status': status.id,
'data_0':'', 'data_0':'',
'data_1':''}) 'data_1':''})
response = admin_client.post(url_lote, {'salvar':'salvar'}, follow=True) response = admin_client.post(url_lote, {'salvar':'salvar'}, follow=True)
@ -1026,7 +1026,7 @@ def test_tramitacao_lote_documentos_views(admin_client):
assert 'Status: Este campo é obrigatório.' in msgs assert 'Status: Este campo é obrigatório.' in msgs
assert 'Unidade Destino: Este campo é obrigatório.' in msgs assert 'Unidade Destino: Este campo é obrigatório.' in msgs
assert 'Texto da Ação: Este campo é obrigatório.' in msgs assert 'Texto da Ação: Este campo é obrigatório.' in msgs
response = admin_client.post(url_lote, response = admin_client.post(url_lote,
{'documentos': documentos, {'documentos': documentos,
'data_tramitacao': date(2019, 5, 15), 'data_tramitacao': date(2019, 5, 15),
@ -1035,7 +1035,7 @@ def test_tramitacao_lote_documentos_views(admin_client):
'status': status.id, 'status': status.id,
'urgente': False, 'urgente': False,
'texto': 'aaaa', 'texto': 'aaaa',
'salvar':'salvar'}, 'salvar':'salvar'},
follow=True) follow=True)
assert response.status_code == 200 assert response.status_code == 200
@ -1051,7 +1051,7 @@ def test_tramitacao_lote_documentos_views(admin_client):
# O documento anexado ao anexado não deve tramitar junto porque já está com tramitação diferente # O documento anexado ao anexado não deve tramitar junto porque já está com tramitação diferente
documentos = [documento_principal.id] documentos = [documento_principal.id]
response = admin_client.post(url, response = admin_client.post(url,
{'documentos': documentos, {'documentos': documentos,
'data_tramitacao': date(2019, 5, 15), 'data_tramitacao': date(2019, 5, 15),
'unidade_tramitacao_local': unidade_tramitacao_local_1.id, 'unidade_tramitacao_local': unidade_tramitacao_local_1.id,
@ -1059,9 +1059,9 @@ def test_tramitacao_lote_documentos_views(admin_client):
'status': status.id, 'status': status.id,
'urgente': False, 'urgente': False,
'texto': 'aaaa', 'texto': 'aaaa',
'salvar':'salvar'}, 'salvar':'salvar'},
follow=True) follow=True)
assert response.status_code == 200 assert response.status_code == 200
assert TramitacaoAdministrativo.objects.all().count() == 6 assert TramitacaoAdministrativo.objects.all().count() == 6
@ -1077,7 +1077,7 @@ def test_tramitacao_lote_documentos_views(admin_client):
'status': status.id, 'status': status.id,
'urgente': False, 'urgente': False,
'texto': 'aaaa', 'texto': 'aaaa',
'salvar':'salvar'}, 'salvar':'salvar'},
follow=True) follow=True)
assert response.status_code == 200 assert response.status_code == 200
@ -1090,7 +1090,7 @@ def test_tramitacao_lote_documentos_views(admin_client):
assert documento_anexado.tramitacaoadministrativo_set.all().count() == 2 assert documento_anexado.tramitacaoadministrativo_set.all().count() == 2
# Terceira tramitação em lote # Terceira tramitação em lote
# Agora, o documento anexado ao anexado deve tramitar junto com o documento principal, # Agora, o documento anexado ao anexado deve tramitar junto com o documento principal,
# pois suas tramitações convergiram # pois suas tramitações convergiram
response = admin_client.post(url_lote, response = admin_client.post(url_lote,
@ -1101,7 +1101,7 @@ def test_tramitacao_lote_documentos_views(admin_client):
'status': status.id, 'status': status.id,
'urgente': False, 'urgente': False,
'texto': 'aaaa', 'texto': 'aaaa',
'salvar':'salvar'}, 'salvar':'salvar'},
follow=True) follow=True)
assert response.status_code == 200 assert response.status_code == 200
@ -1128,7 +1128,7 @@ def test_tramitacao_lote_documentos_views(admin_client):
# O documento anexado não deve tramitar junto com o prinicpal # O documento anexado não deve tramitar junto com o prinicpal
documentos = [documento_principal.id] documentos = [documento_principal.id]
response = admin_client.post(url, response = admin_client.post(url,
{'documentos': documentos, {'documentos': documentos,
'data_tramitacao': date(2019, 5, 15), 'data_tramitacao': date(2019, 5, 15),
'unidade_tramitacao_local': unidade_tramitacao_local_1.id, 'unidade_tramitacao_local': unidade_tramitacao_local_1.id,
@ -1136,9 +1136,9 @@ def test_tramitacao_lote_documentos_views(admin_client):
'status': status.id, 'status': status.id,
'urgente': False, 'urgente': False,
'texto': 'aaaa', 'texto': 'aaaa',
'salvar':'salvar'}, 'salvar':'salvar'},
follow=True) follow=True)
assert response.status_code == 200 assert response.status_code == 200
assert TramitacaoAdministrativo.objects.all().count() == 1 assert TramitacaoAdministrativo.objects.all().count() == 1
@ -1149,7 +1149,7 @@ def test_tramitacao_lote_documentos_views(admin_client):
# Tramitar o doc anexado ao principal para testar a segunda tramitação em lote # Tramitar o doc anexado ao principal para testar a segunda tramitação em lote
documentos = [documento_anexado.id] documentos = [documento_anexado.id]
response = admin_client.post(url, response = admin_client.post(url,
{'documentos': documentos, {'documentos': documentos,
'data_tramitacao': date(2019, 5, 15), 'data_tramitacao': date(2019, 5, 15),
'unidade_tramitacao_local': unidade_tramitacao_local_1.id, 'unidade_tramitacao_local': unidade_tramitacao_local_1.id,
@ -1157,9 +1157,9 @@ def test_tramitacao_lote_documentos_views(admin_client):
'status': status.id, 'status': status.id,
'urgente': False, 'urgente': False,
'texto': 'aaaa', 'texto': 'aaaa',
'salvar':'salvar'}, 'salvar':'salvar'},
follow=True) follow=True)
assert response.status_code == 200 assert response.status_code == 200
assert TramitacaoAdministrativo.objects.all().count() == 2 assert TramitacaoAdministrativo.objects.all().count() == 2
@ -1181,7 +1181,7 @@ def test_tramitacao_lote_documentos_views(admin_client):
'status': status.id, 'status': status.id,
'urgente': False, 'urgente': False,
'texto': 'aaaa', 'texto': 'aaaa',
'salvar':'salvar'}, 'salvar':'salvar'},
follow=True) follow=True)
assert response.status_code == 200 assert response.status_code == 200

2
sapl/protocoloadm/views.py

@ -24,7 +24,7 @@ from django.shortcuts import redirect, get_object_or_404
from django.shortcuts import render from django.shortcuts import render
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.generic import ListView, CreateView, UpdateView from django.views.generic import ListView, CreateView, UpdateView
from django.views.generic.base import RedirectView, TemplateView from django.views.generic.base import RedirectView, TemplateView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView

2
sapl/redireciona_urls/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

2
sapl/relatorios/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

2
sapl/relatorios/forms.py

@ -3,7 +3,7 @@ from crispy_forms.bootstrap import (FormActions)
from crispy_forms.layout import (HTML, Button, Fieldset, from crispy_forms.layout import (HTML, Button, Fieldset,
Layout, Submit) Layout, Submit)
from django import forms from django import forms
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from sapl.audiencia.models import AudienciaPublica from sapl.audiencia.models import AudienciaPublica
from sapl.base.models import Autor from sapl.base.models import Autor

2
sapl/relatorios/views.py

@ -10,7 +10,7 @@ from django.db.models import Count, Q, F
from django.http import Http404, HttpResponse from django.http import Http404, HttpResponse
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView, ListView from django.views.generic import TemplateView, ListView
from django_filters.views import FilterView from django_filters.views import FilterView
from weasyprint import HTML, CSS from weasyprint import HTML, CSS

2
sapl/rules/__init__.py

@ -1,4 +1,4 @@
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
default_app_config = 'sapl.rules.apps.AppConfig' default_app_config = 'sapl.rules.apps.AppConfig'

2
sapl/rules/apps.py

@ -8,7 +8,7 @@ from django.contrib.auth.management import _get_all_permissions
from django.core import exceptions from django.core import exceptions
from django.db import models, router from django.db import models, router
from django.db.utils import DEFAULT_DB_ALIAS from django.db.utils import DEFAULT_DB_ALIAS
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from sapl.rules import (SAPL_GROUP_ADMINISTRATIVO, SAPL_GROUP_COMISSOES, from sapl.rules import (SAPL_GROUP_ADMINISTRATIVO, SAPL_GROUP_COMISSOES,
SAPL_GROUP_GERAL, SAPL_GROUP_MATERIA, SAPL_GROUP_NORMA, SAPL_GROUP_GERAL, SAPL_GROUP_MATERIA, SAPL_GROUP_NORMA,

2
sapl/rules/tests/test_rules.py

@ -3,7 +3,7 @@ from django.conf import settings
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.utils import six from django.utils import six
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import pytest import pytest
from sapl.base.models import CasaLegislativa from sapl.base.models import CasaLegislativa

2
sapl/sessao/apps.py

@ -1,5 +1,5 @@
from django import apps from django import apps
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
class AppConfig(apps.AppConfig): class AppConfig(apps.AppConfig):

2
sapl/sessao/forms.py

@ -10,7 +10,7 @@ from django.db import transaction
from django.db.models import Q from django.db.models import Q
from django.forms import ModelForm from django.forms import ModelForm
from django.forms.widgets import CheckboxSelectMultiple from django.forms.widgets import CheckboxSelectMultiple
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import django_filters import django_filters
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor

2
sapl/sessao/models.py

@ -4,7 +4,7 @@ from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.db.models import Q, F from django.db.models import Q, F
from django.utils import timezone, formats from django.utils import timezone, formats
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_utils import Choices from model_utils import Choices
from sapl.base.models import Autor from sapl.base.models import Autor

2
sapl/sessao/tests/test_sessao.py

@ -1,7 +1,7 @@
import pytest import pytest
from datetime import datetime from datetime import datetime
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_bakery import baker from model_bakery import baker
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa

16
sapl/sessao/tests/test_sessao_view.py

@ -1,6 +1,6 @@
import pytest import pytest
from django.urls import reverse from django.urls import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from model_bakery import baker from model_bakery import baker
from sapl.parlamentares.models import Legislatura, SessaoLegislativa from sapl.parlamentares.models import Legislatura, SessaoLegislativa
@ -13,7 +13,7 @@ from sapl.sessao.models import (SessaoPlenaria, TipoSessaoPlenaria,
from sapl.parlamentares.models import Parlamentar, CargoMesa, Filiacao from sapl.parlamentares.models import Parlamentar, CargoMesa, Filiacao
from sapl.sessao.views import (get_identificacao_basica, get_conteudo_multimidia, from sapl.sessao.views import (get_identificacao_basica, get_conteudo_multimidia,
get_mesa_diretora, get_presenca_sessao, get_mesa_diretora, get_presenca_sessao,
get_expedientes, get_materias_expediente, get_expedientes, get_materias_expediente,
get_oradores_expediente, get_presenca_ordem_do_dia, get_oradores_expediente, get_presenca_ordem_do_dia,
get_materias_ordem_do_dia, get_oradores_explicacoes_pessoais, get_materias_ordem_do_dia, get_oradores_explicacoes_pessoais,
@ -78,11 +78,11 @@ class TestResumoView():
id_basica = get_identificacao_basica(self.sessao_plenaria) id_basica = get_identificacao_basica(self.sessao_plenaria)
info_basica = id_basica['basica'] info_basica = id_basica['basica']
assert info_basica[0] == 'Tipo de Sessão: ' + str(self.sessao_plenaria.tipo) assert info_basica[0] == 'Tipo de Sessão: ' + str(self.sessao_plenaria.tipo)
data_inicio = self.sessao_plenaria.data_inicio data_inicio = self.sessao_plenaria.data_inicio
abertura = data_inicio.strftime('%d/%m/%Y') if data_inicio else '' abertura = data_inicio.strftime('%d/%m/%Y') if data_inicio else ''
assert info_basica[1] == 'Abertura: ' + abertura +' - '+ self.sessao_plenaria.hora_inicio assert info_basica[1] == 'Abertura: ' + abertura +' - '+ self.sessao_plenaria.hora_inicio
data_fim = self.sessao_plenaria.data_fim data_fim = self.sessao_plenaria.data_fim
encerramento = data_fim.strftime('%d/%m/%Y') + ' -' if data_fim else '' encerramento = data_fim.strftime('%d/%m/%Y') + ' -' if data_fim else ''
assert info_basica[2] == 'Encerramento: ' + encerramento +' '+ self.sessao_plenaria.hora_fim assert info_basica[2] == 'Encerramento: ' + encerramento +' '+ self.sessao_plenaria.hora_fim
@ -102,11 +102,11 @@ class TestResumoView():
def test_get_mesa_diretora(self): def test_get_mesa_diretora(self):
mesa = get_mesa_diretora(self.sessao_plenaria) mesa = get_mesa_diretora(self.sessao_plenaria)
assert mesa == {'mesa':[{ assert mesa == {'mesa':[{
'cargo': self.cargo_mesa, 'cargo': self.cargo_mesa,
'parlamentar': self.parlamentar 'parlamentar': self.parlamentar
}]} }]}
def test_get_presenca_sessao(self): def test_get_presenca_sessao(self):
justificativa = baker.make(JustificativaAusencia,sessao_plenaria=self.sessao_plenaria) justificativa = baker.make(JustificativaAusencia,sessao_plenaria=self.sessao_plenaria)
presenca = baker.make(SessaoPlenariaPresenca,sessao_plenaria=self.sessao_plenaria) presenca = baker.make(SessaoPlenariaPresenca,sessao_plenaria=self.sessao_plenaria)
@ -114,7 +114,7 @@ class TestResumoView():
resposta_presenca = get_presenca_sessao(self.sessao_plenaria) resposta_presenca = get_presenca_sessao(self.sessao_plenaria)
assert resposta_presenca['presenca_sessao'] == [presenca.parlamentar] assert resposta_presenca['presenca_sessao'] == [presenca.parlamentar]
assert resposta_presenca['justificativa_ausencia'][0] == justificativa assert resposta_presenca['justificativa_ausencia'][0] == justificativa
def test_get_expedientes(self): def test_get_expedientes(self):
tipo_expediente = baker.make(TipoExpediente) tipo_expediente = baker.make(TipoExpediente)
expediente = baker.make(ExpedienteSessao,sessao_plenaria=self.sessao_plenaria,tipo=tipo_expediente) expediente = baker.make(ExpedienteSessao,sessao_plenaria=self.sessao_plenaria,tipo=tipo_expediente)
@ -123,7 +123,7 @@ class TestResumoView():
assert resposta_expediente['expedientes'] == [{ assert resposta_expediente['expedientes'] == [{
'conteudo': expediente.conteudo, 'conteudo': expediente.conteudo,
'tipo': tipo_expediente 'tipo': tipo_expediente
}] }]
def test_get_materias_expediente(self): def test_get_materias_expediente(self):

2
sapl/sessao/views.py

@ -19,7 +19,7 @@ from django.utils.datastructures import MultiValueDictKeyError
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.html import strip_tags from django.utils.html import strip_tags
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.views.generic import (FormView, ListView, TemplateView) from django.views.generic import (FormView, ListView, TemplateView)
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView

2
sapl/test_urls.py

@ -4,7 +4,7 @@ from django.contrib.auth.management import _get_all_permissions
from django.contrib.auth.models import Permission from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.db import transaction from django.db import transaction
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import pytest import pytest
from sapl.crud.base import PermissionRequiredForAppCrudMixin from sapl.crud.base import PermissionRequiredForAppCrudMixin

2
sapl/utils.py

@ -35,7 +35,7 @@ from django.forms.widgets import SplitDateTimeWidget, ClearableFileInput
from django.http.response import JsonResponse, HttpResponse from django.http.response import JsonResponse, HttpResponse
from django.utils import six, timezone from django.utils import six, timezone
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import gettext_lazy as _
import django_filters import django_filters
from easy_thumbnails import source_generators from easy_thumbnails import source_generators
import magic import magic

Loading…
Cancel
Save