What I tried to build is stopped by the fact that I am incorrectly
assuming that a ManyToMany field is updated at the time Menu.save() is
called (or post_save signal handler called in this case). These two
methods of customizing what happens after you save an object DO NOT
apply to ManyToMany fields because they are not updated yet. The
transaction is not complete. I think Django should abstract
transactions and allow signals like pre_transaction_finished and
post_transaction_finished in addition to the ideas found at the page
for this "bug:" http://code.djangoproject.com/ticket/5390. (this post
if for anyone searching the topic)

On Jul 11, 1:57 am, Ryan K <ryankas...@gmail.com> wrote:
> I modified the above _cached_menu method to just create a new object
> every time (shown below). It only seems to get the links right, a
> ManyToMay field, after I save it _twice_? Hmmm...how I get the updated
> many2many table?
>
> def _cache_menu(self, menu, xhtml):
>         """
>         Stores xhtml into the CachedMenuXhtml table where the row's
> menu matches
>         the menu_obj.
>         """
>         if menu and xhtml:
>             cm = self.CachedMenuXhtml(menu=menu,xhtml=xhtml)
>             cm.save()
--~--~---------~--~----~------------~-------~--~----~
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