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

Efficient Solution to Merge nD Points
Python: Flatten a list of Objects
flask: command not found - flask 0.12
PYTHON (Controls & conditional flow)
Efficiently sorting and grouping really big arrays
Remove unwanted leading slash from nginx
Callback function on pin state change
Why does my Python code keeps running even after 10 seconds?
How to resample a time series per decades in python
What's the role of string = “” in a program Python
Autoresizing Canvas in a Kivy App
Pip install for Python 3.0 (win XP)
Subselect by columns in MultiIndex Pandas DataFame
Machine learning for a Ruby on rails application [closed]
Memory error with np array when making document term matrix in python 2.7
How to Create an XML file directly from DS18B20 sensor in raspberry Pi?

Categories

HOME
xbox-live
dotnetrdf
bower
wampserver
defragmentation
jpanel
websphere-liberty
eval
structuremap
diagram
hosts
hashicorp-vault
data-analysis
cosmicmind
riak
jquery-terminal
zoomcharts
prestodb
tweets
tortoisegit
apple-tv
fop
tcpclient
richfaces
explode
scalajs-react
codelite
pptp
roundcube
encase
helix-3d-toolkit
skygear
shapes
threshold
vmd
parse-android-sdk
poco-libraries
concrete5-5.7
nashorn
taglib
ivona
estimation
lirc
pinvoke
mouseclick-event
persistent
crystal-reports-8.5
fedora20
windows-azure-pack
cron-task
pax-web
foxit
gradle-eclipse
gemini
mpeg-4
difference
anythingslider
mirrorlink
app.xaml
jericho-html-parser
windowlistener
magento-1.12
sqoop2
author
data-generation
uipickerviewcontroller
bigint
cdata
facebook-sdk-3.1
localtime
client-side-scripting
qss
qtgui
fileconveyor
fortran77
graph-coloring
arbor.js
cgpath
osi
linkedhashset
cadisplaylink
continuous-testing
z-machine
driving-directions
hashalgorithm
path-manipulation
printing-web-page
junit3
sendfile
oggvorbis
usergroups





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