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

Data not received by twisted socket connection
python loop dencrementing a variable for every iteration
Histograms: “TypeError, list indices must be integers, not str”
Scipy fmin_slsqp error “failed in converting 8th argument `g' of _slsqp.slsqp to C/Fortran array”
SciPy: n-dimensional interpolation of sparse data
Write a program to display all the anagrams for “abcdef” in Python
Python prime numbers generators in terminal
Python Square function using newton's algorithm
Titles for elements in tkinter
Adding items to a list if it's not a function
Selenium (python): can't switch to iframe (name is dynamically generated)
How to redirect printed value of python script to the linux terminal as a command
Selenuim webdriver fails without notice for ssl error
Unable to locate button element using selenium webdriver
Simple Image Deconvolution issue
In Python, what is the easiest way to add a list consisting of keyword pairs to a dictionary?

Categories

HOME
jdbc
batch-processing
admin-on-rest
openssl
wsdl
ubuntu-12.04
ll
eval
uiscrollview
data-synchronization
data-analysis
maxima
glpk
ida
bootstrap-popover
riak-ts
arm-template
movies
linq-to-sql
attask
plupload
flexboxgrid
prediction
os161
myob
switching
visual-c++-2017
web-frontend
pygooglechart
pep8-assembly
rowcount
expand
skygear
canvasjs
mmdrawercontroller
vsts-package-management
issue-tracking
dql
freetts
polyfills
soundjs
android-preferences
common.logging
ical-dotnet
apiary
w3-total-cache
crystal-reports-8.5
volume
opencpu
unity3d-editor
emgu
garrys-mod
keycode
nsfetchedresultscontrolle
boost-hana
shipitjs
nssplitview
image-editing
aerogear
interactive-brokers
brackets-shell
magento-1.4
approval-tests
asymptote
throughput
coldfusion-7
optionbutton
sem
rspec3
subversion-edge
hg-git
utf-32
tcpreplay
genetic-programming
phpdocx
joox
delphi-xe3
dbsetup
visual-studio-addins
sanitization
exiv2
gamepad
client-side-scripting
objcmongodb
maven-ear-plugin
osi
cadisplaylink
hobo
entity-framework-ctp5
msgbox
throttling
paintcomponent
grooveshark
microsoft.ink
data-execution-prevention
hardware-infrastructure

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