jpwatts / django-positions

A Django field for custom model ordering.
BSD 3-Clause "New" or "Revised" License
284 stars 71 forks source link

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

Closed murdav closed 10 years ago

murdav commented 10 years ago

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

murdav commented 10 years ago

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

jpwatts commented 10 years ago

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.