Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Django ModelAdmin doesn't seem to save m2m fields with save_model [RSS Feed]

#1 June 23, 2010 17:41:54

Xavier O.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Django ModelAdmin doesn't seem to save m2m fields with save_model


Hi,

I have some trouble understanding how ModelAdmin do save models when those have
many to many fields.

Long story:
I have for one of my application overridden ModelAdmin class and the save_model.

Basicaly, the save_model is:

def save_model(self, request, obj, form, change):
super(TranslationAdmin, self).save_model(request, obj, form, change)
# Some other processing

However, I have noticed that if the object has a many to many field, it isn't
saved.

I looked at ModelAdmin and BaseModelAdmin classes and all I saw is
BaseModelAdmin doing a simple obj.save()
I just don't understand why my many to many fields aren't saved.

I added a form.save_m2m() in my save_model but I still don't understand why I
need it.

Could someone help me understand or simply point me in a direction to look at
please ?

Regards,
Xavier.

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Django ModelAdmin doesn't seem to save m2m fields with save_model [RSS Feed]

Board footer

Moderator control

Enjoy the 15th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support