|
@ -2,7 +2,7 @@ |
|
|
from django.contrib.auth.models import Group |
|
|
from django.contrib.auth.models import Group |
|
|
from django.contrib.contenttypes.fields import GenericRelation |
|
|
from django.contrib.contenttypes.fields import GenericRelation |
|
|
from django.contrib.contenttypes.models import ContentType |
|
|
from django.contrib.contenttypes.models import ContentType |
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
from django.core.exceptions import ObjectDoesNotExist,MultipleObjectsReturned |
|
|
from django.db import models |
|
|
from django.db import models |
|
|
from django.db.models.functions import Concat |
|
|
from django.db.models.functions import Concat |
|
|
from django.template import defaultfilters |
|
|
from django.template import defaultfilters |
|
@ -261,17 +261,14 @@ class MateriaLegislativa(models.Model): |
|
|
''' |
|
|
''' |
|
|
from sapl.protocoloadm.models import Protocolo |
|
|
from sapl.protocoloadm.models import Protocolo |
|
|
if self.ano and self.numero_protocolo: |
|
|
if self.ano and self.numero_protocolo: |
|
|
try: |
|
|
protocolo = Protocolo.objects.filter( |
|
|
protocolo = Protocolo.objects.get( |
|
|
|
|
|
ano=self.ano, |
|
|
ano=self.ano, |
|
|
numero=self.numero_protocolo) |
|
|
numero=self.numero_protocolo) |
|
|
if protocolo.timestamp: |
|
|
if protocolo.first().timestamp: |
|
|
return protocolo.timestamp.date() |
|
|
return protocolo.first().timestamp.date() |
|
|
else: |
|
|
else: |
|
|
return protocolo.data |
|
|
return protocolo.data |
|
|
except ObjectDoesNotExist: |
|
|
else: |
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
return '' |
|
|
return '' |
|
|
|
|
|
|
|
|
def delete(self, using=None, keep_parents=False): |
|
|
def delete(self, using=None, keep_parents=False): |
|
|