Hey,
I have a modelfrom generated from a db model A that has a m2m filed to
model B. On the same page i show a modelformset with 3 instances of
model B. What is the best way to save the m2m field? I tried this code
but it looks a bit hacky to overwrite the m2m(texte) filed by myself.
Is there a better way to do it?
Thx
bastir
if f.is_valid() and formset.is_valid():
texte = formset.save()
dbobj = f.save(commit=False)
dbobj.basic_ptr.stand_id = stand_id
dbobj.save()
for txt in texte:
dbobj.texte.add(txt)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.