Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

post_save signal on m2m field

I have a pretty generic Article model, with m2m relation to Tag model. I want to keep count of each tag usage, i think the best way would be to denormalise count field on Tag model and update it each time Article being saved. How can i accomplish this, or maybe there's a better way?

like image 794
Dmitry Shevchenko Avatar asked Oct 27 '08 17:10

Dmitry Shevchenko


1 Answers

This is a new feature in Django 1.2: http://docs.djangoproject.com/en/dev/ref/signals/#m2m-changed

like image 65
Christian Oudard Avatar answered Oct 15 '22 05:10

Christian Oudard