Overriding save() + site framework = nothing changed when clicking save in the admin
I overrided the save method of one of my model to it sync its sites
with its parent sites:
def save(self, *args, **kwargs):
ret = models.Model.save(self, *args, **kwargs)
if self.id:
for site in self.parent.sites.all():
self.sites.add(site.id)
This code work, except when you save the object in the admin. Using
PDB, I can see that self.parent.sites.all() return something at the
end of send. But right after, the relations disapears. I'm not
(willingly at least) using transactions.
More details here:
http://stackoverflow.com/questions/5982347/why-is-adding-site-to-an-object-doesnt-seem-to-work-in-a-save-override-in-the
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home