Tuesday, June 21, 2011

Re: saving related objects in overridden save method on model

Woops, I forgot to include the super's save method call in my
example. Just want to make sure no one thinks that was the problem...

def save(self, *args, **kwargs):
if not self.considered.filter(id=self.requested.id):
self.considered.add(self.requested)
super(Person, self).save(*args, **kwargs)

--
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