-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2879 from prefeiturasp/release/9.3.0
Release/9.3.0
- Loading branch information
Showing
37 changed files
with
739 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = "9.2.1" | ||
__version__ = "9.3.0" | ||
|
||
__version_info__ = tuple( | ||
[ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
sme_ptrf_apps/core/api/views/parametrizacoes_acoes_associacoes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from django.db.models import Q | ||
from django_filters import rest_framework as filters | ||
|
||
from rest_framework import mixins | ||
from rest_framework.permissions import IsAuthenticated | ||
from rest_framework.viewsets import GenericViewSet | ||
|
||
from sme_ptrf_apps.core.api.serializers import AcaoAssociacaoRetrieveSerializer | ||
from sme_ptrf_apps.core.api.utils.pagination import CustomPagination | ||
from sme_ptrf_apps.core.choices.filtro_informacoes_associacao import FiltroInformacoesAssociacao | ||
from sme_ptrf_apps.core.models import AcaoAssociacao | ||
from sme_ptrf_apps.users.permissoes import PermissaoApiUe | ||
|
||
|
||
class ParametrizacoesAcoesAssociacaoViewSet(mixins.ListModelMixin, GenericViewSet): | ||
permission_classes = [IsAuthenticated & PermissaoApiUe] | ||
lookup_field = 'uuid' | ||
queryset = AcaoAssociacao.objects.all() | ||
serializer_class = AcaoAssociacaoRetrieveSerializer | ||
filter_backends = (filters.DjangoFilterBackend,) | ||
filter_fields = ('acao__uuid', 'status', 'associacao__uuid') | ||
pagination_class = CustomPagination | ||
|
||
def get_queryset(self): | ||
qs = AcaoAssociacao.objects.all().order_by('associacao__nome', 'acao__nome') | ||
|
||
nome = self.request.query_params.get('nome') | ||
filtro_informacoes = self.request.query_params.get('filtro_informacoes') | ||
filtro_informacoes_list = filtro_informacoes.split(',') if filtro_informacoes else [] | ||
|
||
encerradas = FiltroInformacoesAssociacao.FILTRO_INFORMACOES_ENCERRADAS | ||
nao_encerradas = FiltroInformacoesAssociacao.FILTRO_INFORMACOES_NAO_ENCERRADAS | ||
|
||
if nome is not None: | ||
qs = qs.filter(Q(associacao__nome__unaccent__icontains=nome) | Q( | ||
associacao__unidade__nome__unaccent__icontains=nome) | Q( | ||
associacao__unidade__codigo_eol__icontains=nome)) | ||
|
||
if filtro_informacoes_list: | ||
if encerradas in filtro_informacoes_list and nao_encerradas in filtro_informacoes_list: | ||
qs = qs | ||
elif nao_encerradas in filtro_informacoes_list: | ||
qs = qs.filter(associacao__data_de_encerramento__isnull=True) | ||
|
||
elif encerradas in filtro_informacoes_list: | ||
qs = qs.filter(associacao__data_de_encerramento__isnull=False) | ||
|
||
return qs.order_by('associacao__nome', 'acao__nome') |
58 changes: 58 additions & 0 deletions
58
sme_ptrf_apps/core/api/views/parametrizacoes_associacoes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from rest_framework.permissions import IsAuthenticated | ||
|
||
from sme_ptrf_apps.users.permissoes import ( | ||
PermissaoApiUe, | ||
) | ||
|
||
from sme_ptrf_apps.core.models import Associacao | ||
from django_filters import rest_framework as filters | ||
from django.db.models import Q | ||
from rest_framework.filters import SearchFilter | ||
|
||
from ..serializers.associacao_serializer import ( | ||
AssociacaoListSerializer | ||
) | ||
|
||
from sme_ptrf_apps.core.api.utils.pagination import CustomPagination | ||
from rest_framework import mixins | ||
from rest_framework.viewsets import GenericViewSet | ||
|
||
from ...choices import FiltroInformacoesAssociacao | ||
|
||
|
||
class ParametrizacoesAssociacoesViewSet(mixins.ListModelMixin, GenericViewSet): | ||
permission_classes = [IsAuthenticated & PermissaoApiUe] | ||
lookup_field = 'uuid' | ||
queryset = Associacao.objects.all() | ||
serializer_class = AssociacaoListSerializer | ||
filter_backends = (filters.DjangoFilterBackend, SearchFilter,) | ||
filter_fields = ('unidade__dre__uuid', 'unidade__tipo_unidade') | ||
pagination_class = CustomPagination | ||
|
||
def get_queryset(self): | ||
qs = Associacao.objects.all().order_by('unidade__tipo_unidade', 'unidade__nome') | ||
|
||
uuid_dre = self.request.query_params.get('unidade__dre__uuid') | ||
if uuid_dre is not None and uuid_dre != "": | ||
qs = qs.filter(unidade__dre__uuid=uuid_dre) | ||
|
||
nome = self.request.query_params.get('nome') | ||
if nome is not None: | ||
qs = qs.filter(Q(unidade__codigo_eol=nome) | Q(nome__unaccent__icontains=nome) | Q( | ||
unidade__nome__unaccent__icontains=nome)) | ||
|
||
filtro_informacoes = self.request.query_params.get('filtro_informacoes') | ||
filtro_informacoes_list = filtro_informacoes.split(',') if filtro_informacoes else [] | ||
|
||
encerradas = FiltroInformacoesAssociacao.FILTRO_INFORMACOES_ENCERRADAS | ||
nao_encerradas = FiltroInformacoesAssociacao.FILTRO_INFORMACOES_NAO_ENCERRADAS | ||
|
||
if filtro_informacoes_list: | ||
if encerradas in filtro_informacoes_list and nao_encerradas in filtro_informacoes_list: | ||
qs = qs | ||
elif nao_encerradas in filtro_informacoes_list: | ||
qs = qs.filter(data_de_encerramento__isnull=True) | ||
elif encerradas in filtro_informacoes_list: | ||
qs = qs.filter(data_de_encerramento__isnull=False) | ||
|
||
return qs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
sme_ptrf_apps/core/migrations/0384_alter_funcsmepainelparametrizacoes_options.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 4.2.7 on 2024-04-04 09:01 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0383_merge_20240322_1517"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="funcsmepainelparametrizacoes", | ||
options={ | ||
"default_permissions": (), | ||
"managed": False, | ||
"permissions": ( | ||
( | ||
"access_painel_parametrizacoes", | ||
"[SME] Pode acessar o Painel de parametrizações.", | ||
), | ||
( | ||
"change_painel_parametrizacoes", | ||
"[SME] Pode atualizar o Painel de parametrizações ", | ||
), | ||
), | ||
"verbose_name": "[SME] Painel de Parametrizacoes", | ||
"verbose_name_plural": "[SME] Painel de Parametrizacoes", | ||
}, | ||
), | ||
] |
15 changes: 15 additions & 0 deletions
15
sme_ptrf_apps/core/migrations/0385_delete_funcsmefornecedores.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Generated by Django 4.2.11 on 2024-04-10 12:20 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0384_alter_funcsmepainelparametrizacoes_options"), | ||
] | ||
|
||
operations = [ | ||
migrations.DeleteModel( | ||
name="FuncSmeFornecedores", | ||
), | ||
] |
22 changes: 22 additions & 0 deletions
22
sme_ptrf_apps/core/migrations/0386_ata_pdf_gerado_previamente.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.2.7 on 2024-04-15 11:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0385_delete_funcsmefornecedores"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="ata", | ||
name="pdf_gerado_previamente", | ||
field=models.BooleanField( | ||
blank=True, | ||
default=False, | ||
help_text="O PDF já foi gerado previamente, foi apagado e precisa ser regerado quando editado/apagado", | ||
verbose_name="PDF gerado previamente", | ||
), | ||
), | ||
] |
22 changes: 22 additions & 0 deletions
22
sme_ptrf_apps/core/migrations/0387_alter_ata_pdf_gerado_previamente.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.2.7 on 2024-04-15 11:25 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0386_ata_pdf_gerado_previamente"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="ata", | ||
name="pdf_gerado_previamente", | ||
field=models.BooleanField( | ||
blank=True, | ||
default=False, | ||
help_text="O PDF já foi gerado, foi apagado e precisa ser regerado quando a ata é editada/apagada", | ||
verbose_name="PDF gerado previamente", | ||
), | ||
), | ||
] |
22 changes: 22 additions & 0 deletions
22
sme_ptrf_apps/core/migrations/0388_alter_ata_pdf_gerado_previamente.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.2.7 on 2024-04-15 11:29 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0387_alter_ata_pdf_gerado_previamente"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="ata", | ||
name="pdf_gerado_previamente", | ||
field=models.BooleanField( | ||
blank=True, | ||
default=False, | ||
help_text="O PDF já foi gerado e precisa ser regerado quando a ata é editada/apagada", | ||
verbose_name="PDF gerado previamente", | ||
), | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
sme_ptrf_apps/core/migrations/0389_migrar_campo_pdf_gerado_previamente.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 4.2.7 on 2024-04-15 12:16 | ||
|
||
from django.db import migrations | ||
|
||
def migrar_campo_pdf_gerado_previamente(apps, schema_editor): | ||
model_ata = apps.get_model('core', 'Ata') | ||
atas_com_pdf = model_ata.objects.exclude(arquivo_pdf='') | ||
for ata in atas_com_pdf: | ||
ata.pdf_gerado_previamente = True | ||
ata.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("core", "0388_alter_ata_pdf_gerado_previamente"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(migrar_campo_pdf_gerado_previamente, reverse_code=migrations.RunPython.noop) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.