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.name
class 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.name



views.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





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6d5714b1-c526-4851-a6c9-4700498fc579%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to