i created model form
model.py
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django import forms
from django.forms import ModelForm
CATEGORIES = (
('mh', 'Maharashtra'),
('pb', 'Punjab'),
('gj', 'Gujarat'),
)
Country = (
('ind', 'India'),
('uk', 'United Kingdom'),
('sa', 'South Africa'),
)
class holidaytime(models.Model):
MYdob= models.DateField()
Time= models.DateTimeField()
def __str__(self):
return
self.nameclass Registerform(models.Model):
FirstName = models.CharField(max_length=200)
LastName = models.CharField(max_length=200)
Myprofile = models.FileField(upload_to='uploads/')
Myresume = models.FileField(upload_to='uploads/')
Bio = models.TextField()
State= models.CharField(max_length=3, choices=CATEGORIES)
Country= models.CharField(max_length=3, choices=Country)
def __str__(self):
forms,py
from django import forms
from .models import Registerform
from django.forms import ModelForm
class Regform(forms.ModelForm):
class meta:
model=Registerform
fields=["FirstName","LastName","Myprofile","Myresume","Bio","State","Country"]
return
self.nameviews.py
from django.shortcuts import render
from .forms import Regform
# Create your views here.
def register(request):
s=Regform(request.POST)
return render(request, 'webpage/register.html',{"s":s})
register.html
<!DOCTYPE html>
<html>
<head>
<title>Registration Form</title>
</head>
<body>
<h1>Registration Form</h1>
<form>{% csrf_token %}
{{form.as_p}}
</form>
</body>
</html>
it is not worked..it show
ValueError at /task/
ModelForm has no model class specified. this error