Answer the question
In order to leave comments, you need to log in
How to overcome ModelForm has no model class specified error?
I wanted to create a form for editing personal data.
# Form code forms.py
from django import forms
from .models import AdvUser
class ChangeUserInfoForm (forms.ModelForm):
email = forms.EmailField(required=True,
label='Адрес электронной почты')
class Meta:
model = AdvUser
fields = ('username', 'email', 'first_name', 'last_name',
'send_messages')
ValueError at /accounts/profile/change/
ModelForm has no model class specified.
Request Method: GET
Request URL: http://localhost:8000/accounts/profile/change/
Django Version: 3.2.6
Exception Type: ValueError
Exception Value:
ModelForm has no model class specified.
Exception Location: C:\Program Files\lib\site-packages\django\forms\models.py, line 295, in __init__
Python Executable: C:\Program Files\python.exe
Python Version: 3.9.4
Python Path:
['C:\\Django\\bboard',
'C:\\Program Files\\python39.zip',
'C:\\Program Files\\DLLs',
'C:\\Program Files\\lib',
'C:\\Program Files',
'C:\\Program Files\\lib\\site-packages']
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question