Coverage for apps/patients/signals.py: 73%
11 statements
« prev ^ index » next coverage.py v6.4.4, created at 2024-04-19 09:45 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2024-04-19 09:45 -0600
1from django.db.models import signals
2from django.dispatch import receiver
4from apps.accounting.models import Movement
6from .models import Patient
9@receiver(signals.post_save, sender=Movement)
10def trigger_account_save_after_saving_movement(sender, instance, created, **kwargs):
11 account = instance.account
12 account.save()
15@receiver(signals.pre_save, sender=Patient)
16def set_full_name(sender, instance: Patient, *args, **kwargs):
17 instance.full_name = " ".join(
18 filter(None, (instance.first_name, instance.middle_name, instance.father_last_name, instance.mother_last_name))
19 )