Найти - Пользователи
Полная версия: Cannot set values on a ManyToManyField which specifies an intermediary model.
Начало » Django » Cannot set values on a ManyToManyField which specifies an intermediary model.
1
Kamo
Весь необходимый код, чтобы разобраться, http://pastebin.com/YjRC7kYx

При сохранении вылетает ошибка
Cannot set values on a ManyToManyField which specifies an intermediary model. Use page.StyleRelationship's Manager instead.

Мне по сути нужно сохранить только Style. Доку перечитал вдоль и поперек и не понял где и что пропустил.

Help meeeeee!!!
Antonio051
https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/
The save() method
Another side effect of using commit=False……..

if style_form.is_valid():
    style = style_form.save(commit=false)
    style_form.save_m2m()
    
Kamo
Antonio051
https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/The save() methodAnother side effect of using commit=False……..
Спасибо.
Достаточно было
if style_form.is_valid():
    style = style_form.save(commit=false)
    style.save()
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB