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/2941/head
Cesar Augusto de Carvalho
6 years ago
committed by
Edward
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-09 16:19 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('sessao', '0044_merge_20190802_1117'), |
||||
|
] |
||||
|
|
||||
|
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,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.11.20 on 2019-08-09 16:19 |
||||
|
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', '0045_auto_20190809_1319'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RunPython(migra_ordenacao_tipos) |
||||
|
] |
Loading…
Reference in new issue