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

how to read files with special characters in python
Using the Python Request Library to get Google Oauth2 tokens
(Beginner)Python functions Codeacademy
Python script hangs
How to shift a list nth time in Left or Right and fill it up with 0 in python
NumPy, why equality check does not work for an array of objects?
String formatting of timedeltas in Pandas
Celery - How to send task from remote machine?
YouTube Api v3 handling Exceptions in Python
Copy data from one oracle database to another with Python
converting python program into executable
How to use multidatabase across multiproject in django?
SSLHandshakeError when connecting to Google Analytics using Google APIs Client Library for Python
Pandas Pivot Table Display in ReportLab
python multiprocessing behaviour
How do You Hack the Enthought Canopy Editor Background Color?

Categories

HOME
paypal
vue.js
jenkins-plugins
answer-set-programming
nuxeo
snap.svg
filter
user
devstack
websphere-liberty
gimp
ipfs
pjsip
tee
squarespace
lstm
bar-chart
zoomcharts
derived
tree-traversal
internet-explorer-8
ip-camera
remove-method
memsql
npm-install
pipelinedb
onesignal
rhmap
vcard
partial-application
dd-wrt
ivy
fractals
google-drive-realtime-api
equivalence
rule
cgo
stdclass
code-composer
productivity
ti-basic
istorage
applepayjs
bnd
cgcontext
httplib2
visual-studio-templates
pdfkit
svn-merge
nsfetchedresultscontrolle
cron-task
ruby-2.0
nssplitview
spring-lemon
mpeg-4
qt-linguist
eml
cmocka
android-viewholder
windows-vista
datasnap
retro-computing
integral
ffserver
leadtools-sdk
type-mismatch
criteria-api
swift2.1
start-job
pisa
rhel5
kendo-mvvm
docopt
sthttprequest
sid
initialization-vector
roxygen
sanitization
bfd
real-time-updates
driver-signing
windows-update
fortran77
gdataxml
trailing-slash
marmalade-edk
cgpath
code-conversion
bulbs
qsqltablemodel
n-layer
gdt
gjs
hobo
flexicious
ajax.beginform
cookieless
noir
junit3
open-graph-beta
mvccontrib-grid
file-encodings
openwysiwyg
scatterview
interface-design

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