jpwatts / django-positions

A Django field for custom model ordering.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MyModel.objects.filter(object_id=id_object).update(position=param_position) not fired

murdav opened this issue · comments

Dear All!

First of all, thanks for this great app!
It seems the event is not fired if I do something similar:
MyModel.objects.filter(object_id=id_object).update(position=param_position)

Ideas?

Thanks!

D

As far as I remember this is a new feature in Django 1.5.

Thanks for the kind words. The code that updates the positions of related model instances relies on Django's post_save signal to trigger the change. As far as I know, Django has never sent the pre_save and post_save signals when the queryset update method is used instead of calling save on a model instance.

I did a little digging and found a couple related issues in the Django bug tracker:

https://code.djangoproject.com/ticket/12184
https://code.djangoproject.com/ticket/21461

The second is interesting because it suggests that there may be pre_update and post_update signals available at some point in the future. If those were in place, we could probably make your query work as expected.

I'm going to close this ticket, but please feel free to re-open if I've misunderstood something about what you're trying to do.