Great to see Mozilla supporting Django. But isn't the official Django tutorial cover all of this, Why not just link to it?
Learn web development: Django Web Framework
51–54 of 54 posts
Re: Learn web development: Django Web Framework
#52Earlier quoted context omitted.
How did you solve the problem of bypassing modelforms? Same roadblock here...
you reference the model in the view and then tell the view to save it directly to the model using the "model = form field" type syntax to assign value and then .save() method to save. In the form field you are saving from, you write the form field value and then an empty space where the input value goes sort of like "form.cleaned_data.get("field name", " "). The second blank ""is the empty space where the field value…
Re: Learn web development: Django Web Framework
#53Earlier quoted context omitted.
you reference the model in the view and then tell the view to save it directly to the model using the "model = form field" type syntax to assign value and then .save() method to save. In the form field you are saving from, you write the form field value and then an empty space where the input value goes sort of like "form.cleaned_data.get("field name", " "). The second blank ""is the empty space where the field value…
Alternative is to use the modelform but not save the created/updated model automatically. Then you modify the resulting model object and save it manually as needed. Works also with models with m2m fields with Form.save_m2m().
Re: Learn web development: Django Web Framework
#54Earlier quoted context omitted.
you reference the model in the view and then tell the view to save it directly to the model using the "model = form field" type syntax to assign value and then .save() method to save. In the form field you are saving from, you write the form field value and then an empty space where the input value goes sort of like "form.cleaned_data.get("field name", " "). The second blank ""is the empty space where the field value…
"The second blank ""is the empty space where the field value goes." I'm not sure I understand what you're saying here, but I don't think this is right. cleaned_data is a dictionary, and so the second argument to get is a default value to use if there is no value corresponding to the key. So, in your example, if there's no value for "formfield1" in cleaned_data, it would return a string with a space in. This is probab…