mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 00:15:17 -06:00
Merge conditionals
This commit is contained in:
parent
417b57171a
commit
7f643f9c58
@ -39,9 +39,8 @@ def post_save_receiver(sender, instance, created, **kwargs):
|
|||||||
# Update the counters on the old and/or new parents as needed
|
# Update the counters on the old and/or new parents as needed
|
||||||
if old_pk is not None:
|
if old_pk is not None:
|
||||||
update_counter(parent_model, old_pk, counter_name, -1)
|
update_counter(parent_model, old_pk, counter_name, -1)
|
||||||
if new_pk is not None:
|
if new_pk is not None and (old_pk or created):
|
||||||
if old_pk or created:
|
update_counter(parent_model, new_pk, counter_name, 1)
|
||||||
update_counter(parent_model, new_pk, counter_name, 1)
|
|
||||||
|
|
||||||
|
|
||||||
def post_delete_receiver(sender, instance, **kwargs):
|
def post_delete_receiver(sender, instance, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user