from django import forms
class ArticleForm(forms.Form):
title = forms.CharField()
content = forms.CharField()
def cleaned_data(self):
cleaned_data - self.cleaned_data #returns dictionary
print(cleaned_data)
title = cleaned_data.get('title')
if title.lower().strip()
print('title')
return title
def clean(self):
cleaned_data = self.cleaned_data
print('all data:', cleaned_data)
return cleaned_data
# in views.py
if request.method == 'POST':
form = ArticleForm(request.POST)
if form.is_valid():
form.save()