When I save an instance in the Django admin, it never works.
When I save an instance in ./manage.py shell it always works.
Why would this be?
For instance, if my code (in the save override) is this:
self.some_m2m_field.clear()
self.some_m2m_field.add(this_thing)
Then if I go into the admin and save the instance, this_thing is not
attached to the instance. But if I do a .save() in the shell and check
it has been assigned.
I assume I'm missing something fundamental about this.
Thanks,
Shawn
I've never encountered this Shawn, but the primary difference between
those two is that saving in the admin will go through a ModelForm.
Does the admin site use frm.save(commit=False) and then run
frm.save_m2m()? frm.save_m2m() would definitely be run after both an
overwritten save() and a post_save hook.
Worth a thought.
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
This is definitely not the case, because these are always records that
already exist, if I'm editing them in the admin.
I still don't know what the problem was, but I solved it by just doing a
delay call to a Celery task, so it happens asynchronously.
I was already using Celery/RabbitMQ, and the functionality was one of
the things I wanted to make async anyway.