Browse Source

Adiciona ordenação em normas (#2524)

pull/2527/head
Edward 6 years ago
committed by GitHub
parent
commit
a011517ca3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      sapl/norma/migrations/0023_auto_20190219_1535.py
  2. 7
      sapl/norma/models.py

19
sapl/norma/migrations/0023_auto_20190219_1535.py

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-02-19 18:35
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('norma', '0022_auto_20190108_1606'),
]
operations = [
migrations.AlterModelOptions(
name='normarelacionada',
options={'ordering': ('norma_principal__ano', 'norma_relacionada__ano'), 'verbose_name': 'Norma Relacionada', 'verbose_name_plural': 'Normas Relacionadas'},
),
]

7
sapl/norma/models.py

@ -145,9 +145,11 @@ class NormaJuridica(models.Model):
def get_normas_relacionadas(self):
principais = NormaRelacionada.objects.filter(
norma_principal=self.id)
norma_principal=self.id).order_by('norma_principal__ano',
'norma_relacionada__ano')
relacionadas = NormaRelacionada.objects.filter(
norma_relacionada=self.id)
norma_relacionada=self.id).order_by('norma_principal__ano',
'norma_relacionada__ano')
return (principais, relacionadas)
def get_anexos_norma_juridica(self):
@ -311,6 +313,7 @@ class NormaRelacionada(models.Model):
class Meta:
verbose_name = _('Norma Relacionada')
verbose_name_plural = _('Normas Relacionadas')
ordering = ('norma_principal__ano', 'norma_relacionada__ano')
def __str__(self):
return _('Principal: %(norma_principal)s'

Loading…
Cancel
Save