Ok, halfly solved.
The problem is that post_save() for parent model doesn't calling for childs models.
So you can solve it by providing child class directly.
class Advertisement(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
author_email = models.EmailField()
class Sale(Advertisement):
rooms = models.IntegerField(max_length=1)
subway = models.ForeignKey(Subway)
class Verification(models.Model):
advertisement = models.ForeignKeyField(Advertisement)
key = models.CharField(max_length=32)
def gen_key(sender, instance, created, **kwargs):
code goes here
post_save.connect(gen_key, sender=Sale, dispatch_uid="my_unique_identifier")
So next question is "How can I use parent class for post_save()?"
--
Daniel Corbe Hahne Latorre
daniel@corbe.com.br
55 48 9618-5115
skype: daniel_corbe
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment