Hello,

Assuming the fields issue is resolved. If not, please show the abcForm.

On Monday 23 January 2017 08:14:09 schaf...@gmail.com wrote:

> I guess I first need to fully understand the Django ModelForm and how
> a template can handle two independent forms. Maybe I also have to
> change the concept?
> data from different models have to be displayed on one template and
> for that 2 ModelForms were generated and added to a main view, but
> this does notwork in 1.9 till now.

The generic class-based views support common patterns, but in a way that more 
complex patterns can be built. Yours is a more complex pattern.
The defaults always assume a one on one relation between a ListView/DetailView 
and 
a Model and also one Form with one FormView.

Under the hood, Model forms are handled like this:
* add the form instance to the template context (using get_context_data[1]) so 
it can 
be rendered
* deligate to form_valid or form_invalid based on the form's is_valid() method, 
if the 
request method is put or post (using ProcessFormView[2] post and put)
* call save() on the ModelForm to save the object(s) (using form_valid[3])

What I'm not seeing in your code is how ModelFormMixin ties in. I'm going to 
guess 
that ProcessFormView is not the ProcessFormView from django.views.generic.edit.
Could you run the django shell (python manage.py shell) import the view and 
show 
it's MRO? For example:
>>> from kernel.views import ModelJSONEncoder
>>> ModelJSONEncoder.__mro__
(<class 'kernel.views.ModelJSONEncoder'>, <class 
'django.core.serializers.json.DjangoJSONEncoder'>, <class 
'json.encoder.JSONEncoder'>, <class 'object'>)

-- 
Melvyn Sopacua

--------
[1] 
https://ccbv.co.uk/projects/Django/1.10/django.views.generic.base/ContextMixin/
[2] 
https://ccbv.co.uk/projects/Django/1.10/django.views.generic.edit/ProcessFormView/
[3] 
https://ccbv.co.uk/projects/Django/1.10/django.views.generic.edit/ModelFormMixin/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3272572.eGOOfIjyfU%40devstation.
For more options, visit https://groups.google.com/d/optout.

Reply via email to