Is there any sane way of trapping insertion/deletion in the ManyRelatedManager? My use case is pretty simple: I would like to add a num_posts field to a Cetgory object that tracks the number of published entries associated with that specific category.
Overriding Entry.save() is useless, as categories are added and removed vua the manyToMany manager in entry.categories, eg entry.categories.add(my_category), etc. I had a look at django/db/models/fields/related.py, and specifically at ManyRelatedManager._add_items, and no signals are raised there, nor it is possible to extend the ManyRelatedManager class as it's dynamically generated inside a method called from (Related)ManyRelatedObjectsDescriptor. It seems like a pretty simple use case, but I can't figure a way to do it, other than writing a full set of custom field/descriptor/manager which seems pretty overkill. Ludo --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---