1👍
You have instantiated a ModelForm without reference to the model. Perhaps you should be using a plain form like so:
from django import forms
class MyForm(forms.Form):
# define fields
If you use a ModelForm you have to specify the model in a Meta internal class like so:
from . import models
from django import forms
class MyForm(forms.ModelForm):
class Meta:
model = models.MyModel
fields = ['field1', 'field2',]
Check out https://docs.djangoproject.com/en/1.9/topics/forms/modelforms/ and https://docs.djangoproject.com/en/1.9/ref/forms/api/ for more details. I would strongly recommend mastering the docs as they are world class.
Source:stackexchange.com