Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

django froms

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()
Comment

PREVIOUS NEXT
Code Example
Python :: yesterday date in python 
Python :: serialization in python 
Python :: run a python file from another python file 
Python :: python range for loop 
Python :: how to make an application using python 
Python :: temp python 
Python :: pick random value from dictionary python 
Python :: sort an array in python 
Python :: re.split 
Python :: python merge sort 
Python :: create a pandas dataframe 
Python :: python includes 
Python :: time library python 
Python :: the range() function 
Python :: for i in range python 
Python :: bokeh bar chart 
Python :: how to make a screen in pygame 
Python :: rename folder python 
Python :: How to use path in Django Python 
Python :: python group by 
Python :: how to make capitalize text in python 
Python :: flatten lists python 
Python :: pip path windows 10 
Python :: how to do the sum of list in python 
Python :: python x = x + 1 
Python :: how to remove trailing zeros in python 
Python :: drop null values in dataframe 
Python :: tkinter while button not pressed 
Python :: email validation using django 
Python :: what is manage.py 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =