Browse Source

Fixes #1604 (#1606)

* Fixes #1604

* adiciona receivers de matéria na app
pull/1610/head
Edward 7 years ago
committed by GitHub
parent
commit
93cd99ea80
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      sapl/materia/apps.py
  2. 10
      sapl/materia/receivers.py

3
sapl/materia/apps.py

@ -6,3 +6,6 @@ class AppConfig(apps.AppConfig):
name = 'sapl.materia'
label = 'materia'
verbose_name = _('Matéria')
def ready(self):
from . import receivers

10
sapl/materia/receivers.py

@ -1,5 +1,7 @@
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from sapl.materia.models import Tramitacao
from sapl.materia.signals import tramitacao_signal
from sapl.utils import get_base_url
@ -17,3 +19,11 @@ def handle_tramitacao_signal(sender, **kwargs):
materia,
tramitacao.status,
tramitacao.unidade_tramitacao_destino)
@receiver(post_delete, sender=Tramitacao)
def status_tramitacao_materia(sender, instance, **kwargs):
if instance.turno == 'F':
materia = instance.materia
materia.em_tramitacao = True
materia.save()

Loading…
Cancel
Save