This is my form.py file:
from django import forms
class PostForm(forms.Form):
title_name = forms.CharField(max_length=255)
description = forms.CharField(max_length=10000)
This is my view.py file:
def createPost(request):
if request.method == "POST":
form = PostForm(request.POST)
print(form.is_valid())
if form.is_valid():
# To extarct data from web page
title = form.cleaned_data['title']
description = form.cleaned_data['description']
print(title)
# To store Data
PostData.objects.create(title_name=title, description=description)
The if Condition is returning False. What’s the problem behind it!?