Browse Source

Adiciona ordenacao em cargo mesa

pull/3637/merge
Edward Ribeiro 1 year ago
parent
commit
3d6729b292
  1. 18
      sapl/comissoes/migrations/0030_auto_20231007_2149.py
  2. 2
      sapl/comissoes/models.py
  3. 19
      sapl/materia/migrations/0084_auto_20231007_2149.py
  4. 22
      sapl/parlamentares/migrations/0043_auto_20231007_2149.py
  5. 5
      sapl/parlamentares/models.py
  6. 2
      sapl/parlamentares/views.py
  7. 2
      sapl/sessao/views.py
  8. 2
      sapl/templates/parlamentares/layouts.yaml

18
sapl/comissoes/migrations/0030_auto_20231007_2149.py

@ -0,0 +1,18 @@
# Generated by Django 2.2.28 on 2023-10-08 00:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0029_auto_20221019_2041'),
]
operations = [
migrations.AlterField(
model_name='cargocomissao',
name='unico',
field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=True, verbose_name='Cargo Único'),
),
]

2
sapl/comissoes/models.py

@ -122,7 +122,7 @@ class CargoComissao(models.Model):
) )
nome = models.CharField(max_length=50, verbose_name=_('Nome do Cargo')) nome = models.CharField(max_length=50, verbose_name=_('Nome do Cargo'))
unico = models.BooleanField( unico = models.BooleanField(
choices=YES_NO_CHOICES, verbose_name=_('Único'), default=True choices=YES_NO_CHOICES, verbose_name=_('Cargo Único'), default=True
) )
class Meta: class Meta:

19
sapl/materia/migrations/0084_auto_20231007_2149.py

@ -0,0 +1,19 @@
# Generated by Django 2.2.28 on 2023-10-08 00:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('materia', '0083_auto_20230731_1845'),
]
operations = [
migrations.AlterField(
model_name='relatoria',
name='materia',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='materia.MateriaLegislativa', verbose_name='Matéria'),
),
]

22
sapl/parlamentares/migrations/0043_auto_20231007_2149.py

@ -0,0 +1,22 @@
# Generated by Django 2.2.28 on 2023-10-08 00:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('parlamentares', '0042_auto_20230529_1641'),
]
operations = [
migrations.AlterModelOptions(
name='cargomesa',
options={'ordering': ['id_ordenacao', 'unico', 'descricao'], 'verbose_name': 'Cargo na Mesa', 'verbose_name_plural': 'Cargos na Mesa'},
),
migrations.AddField(
model_name='cargomesa',
name='id_ordenacao',
field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Posição na Ordenação'),
),
]

5
sapl/parlamentares/models.py

@ -478,11 +478,14 @@ class CargoMesa(models.Model):
max_length=50, verbose_name=_('Cargo na Mesa')) max_length=50, verbose_name=_('Cargo na Mesa'))
unico = models.BooleanField( unico = models.BooleanField(
choices=YES_NO_CHOICES, verbose_name=_('Cargo Único'), default=True) choices=YES_NO_CHOICES, verbose_name=_('Cargo Único'), default=True)
id_ordenacao = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_('Posição na Ordenação'),
)
class Meta: class Meta:
verbose_name = _('Cargo na Mesa') verbose_name = _('Cargo na Mesa')
verbose_name_plural = _('Cargos na Mesa') verbose_name_plural = _('Cargos na Mesa')
ordering = ('unico', 'descricao') ordering = ['id_ordenacao', 'unico', 'descricao']
def __str__(self): def __str__(self):
return self.descricao return self.descricao

2
sapl/parlamentares/views.py

@ -1038,7 +1038,7 @@ class MesaDiretoraView(FormView):
'-data_inicio').first() if sessao_atual else None '-data_inicio').first() if sessao_atual else None
composicao_mesa = ComposicaoMesa.objects.select_related('cargo', 'parlamentar').filter( composicao_mesa = ComposicaoMesa.objects.select_related('cargo', 'parlamentar').filter(
mesa_diretora=mesa_diretora).order_by('cargo_id') mesa_diretora=mesa_diretora).order_by('cargo__id_ordenacao', 'cargo_id')
cargos_ocupados = [m.cargo for m in composicao_mesa] cargos_ocupados = [m.cargo for m in composicao_mesa]
cargos = CargoMesa.objects.all() cargos = CargoMesa.objects.all()

2
sapl/sessao/views.py

@ -1753,7 +1753,7 @@ def atualizar_mesa(request):
# Atualiza os componentes da view após a mudança # Atualiza os componentes da view após a mudança
composicao_mesa = IntegranteMesa.objects.filter( composicao_mesa = IntegranteMesa.objects.filter(
sessao_plenaria=sessao.id).order_by('cargo_id') sessao_plenaria=sessao.id).order_by('cargo__id_ordenacao', 'cargo_id')
cargos_ocupados = [m.cargo for m in composicao_mesa] cargos_ocupados = [m.cargo for m in composicao_mesa]
cargos = CargoMesa.objects.all() cargos = CargoMesa.objects.all()

2
sapl/templates/parlamentares/layouts.yaml

@ -1,7 +1,7 @@
{% load i18n %} {% load i18n %}
CargoMesa: CargoMesa:
{% trans 'Cargo na Mesa'%}: {% trans 'Cargo na Mesa'%}:
- descricao:10 unico - descricao:7 id_ordenacao:3 unico:2
Legislatura: Legislatura:
{% trans 'Legislatura' %}: {% trans 'Legislatura' %}:

Loading…
Cancel
Save