I have a save override in my admin file that catches a value from one
field and applies it to another. The values it grabs from a manytomany
field.

I can get it to work, but only when I save twice. It looks like it
needs the manytomany to update with the new values and then it needs
to second save to assigne the values to the other field.

Here is the method override:

 def save_model(self, request, obj, form, change):
        obj.primary_winner_r = obj.primary_advance_r.values_list('id',
flat=True)
        obj.primary_winner_d = obj.primary_advance_d.values_list('id',
flat=True)
        obj.primary_winner_np =
obj.primary_advance_np.values_list('id', flat=True)
        obj.save()

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to