Browse Source

fix: force_text to force_str

bump_django
LeandroJatai 5 months ago
parent
commit
21ca12990e
  1. 4
      sapl/compilacao/models.py
  2. 8
      sapl/compilacao/views.py
  3. 12
      sapl/crispy_layout_mixin.py
  4. 6
      sapl/crud/base.py
  5. 2
      sapl/materia/views.py
  6. 4
      sapl/norma/views.py
  7. 8
      sapl/protocoloadm/tests/test_protocoloadm.py
  8. 6
      sapl/sessao/views.py

4
sapl/compilacao/models.py

@ -9,7 +9,7 @@ from django.http.response import Http404
from django.template import defaultfilters
from django.utils import timezone
from django.utils.decorators import classonlymethod
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.translation import gettext_lazy as _
from image_cropping.fields import ImageCropField, ImageRatioField
@ -953,7 +953,7 @@ def imagem_upload_path(instance, filename):
class Dispositivo(BaseModel, TimestampedMixin):
TEXTO_PADRAO_DISPOSITIVO_REVOGADO = force_text(_('(Revogado)'))
TEXTO_PADRAO_DISPOSITIVO_REVOGADO = force_str(_('(Revogado)'))
INTERVALO_ORDEM = 1000
ordem = models.PositiveIntegerField(

8
sapl/compilacao/views.py

@ -21,7 +21,7 @@ from django.http.response import (HttpResponse, HttpResponseRedirect,
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse, reverse_lazy
from django.utils.dateparse import parse_date
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.translation import gettext_lazy as _
from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView
@ -1975,18 +1975,18 @@ class ActionDispositivoCreateMixin(ActionsCommonsMixin):
result = [
{
'tipo_insert': force_text("{} {}".format(_('Inserir Após'), base.tipo_dispositivo.nome)),
'tipo_insert': force_str("{} {}".format(_('Inserir Após'), base.tipo_dispositivo.nome)),
'icone': '↷ ',
'action': 'json_add_next',
'itens': []},
{
'tipo_insert': force_text("{} {}".format(_('Inserir em'), base.tipo_dispositivo.nome)),
'tipo_insert': force_str("{} {}".format(_('Inserir em'), base.tipo_dispositivo.nome)),
'icone': '⇲ ',
'action': 'json_add_in',
'itens': []
},
{
'tipo_insert': force_text(_('Inserir Antes')),
'tipo_insert': force_str(_('Inserir Antes')),
'icone': '↶ ',
'action': 'json_add_prior',
'itens': []

12
sapl/crispy_layout_mixin.py

@ -7,7 +7,7 @@ from django import template
from django.contrib.contenttypes.models import ContentType
from django.urls import reverse, reverse_lazy
from django.utils import formats
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.translation import gettext as _
import yaml
@ -40,7 +40,7 @@ def form_actions(more=[Div(css_class='clearfix')],
label=_('Salvar'), name='salvar',
css_class='float-right', disabled=True):
if disabled and force_text(label) != 'Pesquisar':
if disabled and force_str(label) != 'Pesquisar':
doubleclick = 'this.form.submit();this.disabled=true;'
else:
doubleclick = 'return true;'
@ -301,10 +301,10 @@ class CrispyLayoutFormMixin:
def fk_urlify_for_list(self, obj, field):
value = getattr(obj, field)
return reverse(
'%s:%s_detail' % (
value._meta.app_config.name,
value._meta.model_name),
kwargs={'pk': value.id}),
'%s:%s_detail' % (
value._meta.app_config.name,
value._meta.model_name),
kwargs={'pk': value.id}),
def m2m_urlize_for_detail(self, obj, fieldname):

6
sapl/crud/base.py

@ -15,7 +15,7 @@ from django.http.response import Http404
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.decorators import classonlymethod
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.translation import gettext_lazy as _
from django.views.generic import (CreateView, DeleteView, DetailView, ListView,
UpdateView)
@ -433,9 +433,9 @@ class CrudListView(PermissionRequiredContainerCrudMixin, ListView):
hook = 'hook_header_{}'.format(''.join(fn))
if hasattr(self, hook):
header = getattr(self, hook)()
s.append(force_text(header))
s.append(force_str(header))
else:
s.append(force_text(f.verbose_name))
s.append(force_str(f.verbose_name))
else:
hook = 'hook_header_{}'.format(''.join(fn))
if hasattr(self, hook):

2
sapl/materia/views.py

@ -24,7 +24,7 @@ from django.shortcuts import render
from django.template import loader
from django.urls import reverse
from django.utils import formats, timezone
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, ListView, TemplateView, UpdateView
from django.views.generic.base import RedirectView

4
sapl/norma/views.py

@ -12,7 +12,7 @@ from django.template import loader
from django.urls import reverse
from django.urls.base import reverse_lazy
from django.utils import timezone
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView, UpdateView
from django.views.generic.edit import FormView
@ -353,7 +353,7 @@ class NormaCrud(Crud):
return HttpResponseRedirect(url)
def hook_header_epigrafe(self, *args, **kwargs):
return force_text(_('Epigrafe'))
return force_str(_('Epigrafe'))
def hook_epigrafe(self, obj, ss, url):

8
sapl/protocoloadm/tests/test_protocoloadm.py

@ -2,7 +2,7 @@ from datetime import date, timedelta
from django.urls import reverse
from django.utils import timezone
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.translation import gettext_lazy as _
from model_bakery import baker
from urllib.parse import urlencode
@ -168,7 +168,7 @@ def test_create_tramitacao(admin_client):
'data_tramitacao': date(2016, 8, 21)},
follow=True)
msg = force_text(_('A origem da nova tramitação deve ser igual ao '
msg = force_str(_('A origem da nova tramitação deve ser igual ao '
'destino da última adicionada!'))
# Verifica se a origem da nova tramitacao é igual ao destino da última
@ -209,7 +209,7 @@ def test_create_tramitacao(admin_client):
days=1)},
follow=True)
msg = force_text(_('A data de tramitação deve ser ' +
msg = force_str(_('A data de tramitação deve ser ' +
'menor ou igual a data de hoje!'))
# Verifica se a data da tramitação é menor do que a data de hoje
@ -230,7 +230,7 @@ def test_create_tramitacao(admin_client):
'data_encaminhamento': date(2016, 8, 20)},
follow=True)
msg = force_text(_('A data de encaminhamento deve ser ' +
msg = force_str(_('A data de encaminhamento deve ser ' +
'maior que a data de tramitação!'))
# Verifica se a data da encaminhamento é menor do que a data de tramitacao

6
sapl/sessao/views.py

@ -17,7 +17,7 @@ from django.urls.base import reverse_lazy
from django.utils import timezone
from django.utils.datastructures import MultiValueDictKeyError
from django.utils.decorators import method_decorator
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.html import strip_tags
from django.utils.translation import gettext_lazy as _
from django.views.decorators.csrf import csrf_exempt
@ -4007,7 +4007,7 @@ class PesquisarSessaoPlenariaView(MultiFormatOutputMixin, FilterView):
return kwargs
def hook_header_(self):
return force_text(_('Título'))
return force_str(_('Título'))
def hook_(self, obj):
return str(obj)
@ -5281,7 +5281,7 @@ class CorrespondenciaCrud(MasterDetailCrud):
return qs
def hook_header_numero_ordem(self, *args, **kwargs):
return force_text(_('Ordem / Tipo')) if not self.request.user.is_anonymous else force_text(_('Tipo'))
return force_str(_('Ordem / Tipo')) if not self.request.user.is_anonymous else force_str(_('Tipo'))
def hook_numero_ordem(self, obj, ss, url):
if not self.request.user.is_anonymous:

Loading…
Cancel
Save