mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 16:56:10 -06:00
6347 only update count if created
This commit is contained in:
parent
eb0c901a9f
commit
c7a4fd14ee
@ -37,7 +37,8 @@ class Counter(object):
|
||||
name = f"{self.parent_model._meta.model_name}.{self.child_model._meta.model_name}.{self.foreign_key_field.name}"
|
||||
counted_name = f"{name}-{self.counter_name}"
|
||||
|
||||
def post_save_receiver_counter(sender, instance, **kwargs):
|
||||
def post_save_receiver_counter(sender, instance, created, **kwargs):
|
||||
if created:
|
||||
self.increment(instance, 1)
|
||||
|
||||
post_save.connect(
|
||||
|
Loading…
Reference in New Issue
Block a user