python


ModelForm has no model class specified when use model forms


I created a single web page that works for a data entry operator which enter the data to database. I used modelForm to take the data. When I use it django raise an error that "ModelForm has no model class specified". What should I do?
model.py
class Person(models.Model):
NIC = models.CharField(unique=True,max_length=12)
FName = models.CharField(max_length=30)
LName = models.CharField(max_length=30)
FullName = models.CharField(max_length=100)
DOB = models.DateField()
Nationality = models.CharField(max_length=20)
AddressLine1 = models.CharField(max_length=100)
AddressLine2 = models.CharField(max_length=100)
AddressLine3 = models.CharField(max_length=100)
AddressLine4 = models.CharField(max_length=100, null=True,blank=True)
ContactNum = models.CharField(max_length=12)
Email = models.EmailField()
FacebookProf = models.CharField(max_length=100,null=True,blank=True)
LinkedInProf = models.CharField(max_length=100,null=True,blank=True)
PImage = models.ImageField(upload_to= Person_directory_path,null=True)
Objective = models.TextField()
CVPDF = models.ImageField(upload_to=Person_directory_path)
SpecialNotes = models.TextField(blank=True,null=True)
Department = models.ManyToManyField("Department")
Post = models.ManyToManyField("Post")
Degree = models.ManyToManyField("Degree",through="Person_Degree",null=True)
Interview = models.ManyToManyField("Interview",through='Person_Interview',null=True)
def __str__(self):
return self.NIC, self.FName, self.LName, self.FullName, self.Email
forms.py
from django.forms import ModelForm
from django import forms
from .models import Person
class Interview_Form(forms.ModelForm):
class meta:
model = Person
fields = ['NIC', 'FName', 'LName','FullName','Email']
views.py
from .forms import *
def deo(request):
deoForm = Interview_Form()
context = {
'deoForm':deoForm,
}
return render(request, 'deo.html', context)
To me it looks like you're importing ModelForm from django.forms, but when you create Interview_form you are using forms.ModelForm.
You should just be using ModelForm.

Related Links

Can't keep a total of numbers in python
replace if else with a for loop
Panda3D - Setting date
decoding json in python
Python debugging, stop at particular output
Why an avi file can not be opened in OpenCV-Python
Can't compile msgpack Python extension under windows
Python sockets for a n-players game
HTMLParser or urllib2 unicode issue
How to stop PyCharm inserting spaces for fine alignment when reformating code?
Install NLTK with IronPyton for VS2012
pip install won't install on my machine
Integrating using scipy.integrate.simps
Problems with django and virtualenv
Returning when any Future in a list finishes
Python Django - matching query does not exist when using pk

Categories

HOME
sql-server
converter
rest
jsf
vue.js
pug
nlp
rotation
drupal-7
google-tag-manager
bibtex
terrain
xtext
tizen-wearable-sdk
user
height
diagram
vuex
squarespace
rebol2
lenskit
medium-editor
session-timeout
zoomcharts
movies
thumbnails
ejbca
header-files
branch
metadata-extractor
helper
mayavi
configure
ioc-container
crt
lmdb
svnkit
clockwork
spring-profiles
pycparser
npm-shrinkwrap
large-data
rider
xen
bing-maps-api
silverlight-3.0
delphi-10.1-berlin
jquery-multidatespicker
dart-pub
control-flow-graph
catia
fastq
fqdn
chown
dimple.js
mouseclick-event
livescribe
qos
autoresize
polar-coordinates
vici
excon
jackson-databind
inotifypropertychanged
kendo-combobox
clob
emokit
console-redirect
search-regex
test-class
java.util.calendar
jenkins-scriptler
insert-into
subresource-integrity
paypal-nvp
risk-analysis
viper-architecture
isml
gulp-livereload
stackframe
low-level
multipleselection
sthttprequest
neoload
broadcasting
cdata
installshield-2011
dynamic-binding
backbone-relational
zend-lucene
pascals-triangle
qt4.6
template-haskell
wpdb
vt100
mvs
userid
testunit
surefire
visual-c++-2008-express
code-design
scatterview
project-lifecycle

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App