hi
i have this model  Client_Order
i want to do some manipulation each time a new pakg is added to this
field.
i used m2m_changed signal, but it cant distinguish between existing
instances attached and the newly added ones.
both post_add and pre_add show the same number of instances .. i.e if
a.b were attached and i added c instance to it .. both post_add and
pre_add give the same pk_set in kwargs

ACTV_STATUS = (
    ('Active','Active'),
    ('Inactive','Inactive'),
)

class Client_Order(models.Model):
    order_name          = models.CharField(max_length=300)
    order_desc          = models.TextField(verbose_name="Order
Description")
    order_client        = models.ForeignKey(Client_sda)
    order_active_status = models.CharField(choices = ACTV_STATUS,
max_length=300)
    order_pakages       = models.ManyToManyField(Pakage,
help_text="Please attach a maximum of 5 packages only. ")
    discount            = models.IntegerField(default=0)
    total_amount        = models.IntegerField()
    order_booking_date  = models.DateField()
    order_expiry_date   = models.DateField()

@receiver(m2m_changed)
def handle_something(sender, instance, signal,*args, **kwargs):
    print kwargs
    print 'pk_set->',kwargs['pk_set']

how do i distinguish between newly added instances from previously
added ones ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to