خرید بک لینک

Vote count: 0

from django.db.models.signals import post_save
from django.dispatch import receiver

class Coector(models.Model):
    coector_id = models.AutoField(primary_key = True)
    name = models.CharField(max_length=255, null=False,unique=True)
    description = models.TextField(null=True)

class CoectorAud(models.Model):
    id = models.AutoField(primary_key = True)
    ref_coector_id = models.CharField(max_length=255, null=False)
    name = models.CharField(max_length=255, null=False,unique=True)
    description = models.TextField(null=True)

@receiver(post_save, sender=Coector)
def create_coector_audit_trail(sender, **kwargs):
    coector = CoectorAud(
            ref_coector_id = kwargs.get('coector_id'),
            name        =   kwargs.get('name'),
            description =   kwargs.get('description',''),
    )
coector.save()

This causes Coector() to run twice when coector.save() is run

How to solve this problem?

asked 41 secs ago

برچسب: how to use snapchat,how to use uber,how to use lure module,how to use apple pay,how to use pokemon go,how to use a french press,how to use twitter,how to use a tampon,how to use excel,how to use instagram, نویسنده: استخدام کار تاريخ: سه شنبه 9 شهريور 1395 ساعت: 16:47

صفحه بندی