mirror of https://github.com/interlegis/sapl.git
Browse Source
* Fix #2920 - Adiciona campo de ordenação em TipoExpediente * Melhora forma como é obtida variável expedientes vaziospull/2944/head
Cesar Carvalho
5 years ago
5 changed files with 58 additions and 9 deletions
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.11.20 on 2019-08-16 16:36 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('sessao', '0043_auto_20190712_1053'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterModelOptions( |
|||
name='tipoexpediente', |
|||
options={'ordering': ['ordenacao'], 'verbose_name': 'Tipo de Expediente', 'verbose_name_plural': 'Tipos de Expediente'}, |
|||
), |
|||
migrations.AddField( |
|||
model_name='tipoexpediente', |
|||
name='ordenacao', |
|||
field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Ordenação'), |
|||
), |
|||
] |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.11.20 on 2019-08-16 16:37 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
def migra_ordenacao_tipos(apps, schema_editor): |
|||
TipoExpediente = apps.get_model('sessao', 'TipoExpediente') |
|||
|
|||
for i,tipo in enumerate(TipoExpediente.objects.all().order_by('nome')): |
|||
tipo.ordenacao=i+1 |
|||
tipo.save() |
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('sessao', '0044_auto_20190816_1336'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.RunPython(migra_ordenacao_tipos) |
|||
] |
Loading…
Reference in new issue