Skip to content

Instantly share code, notes, and snippets.

@fandrefh
Created September 15, 2017 10:31
Show Gist options
  • Save fandrefh/96b49612efe17ed694335c2e430c5086 to your computer and use it in GitHub Desktop.
Save fandrefh/96b49612efe17ed694335c2e430c5086 to your computer and use it in GitHub Desktop.
#forms.py
class MyForm(forms.Form):
field1 = forms.CharField(label='Field 1')
#views.py
def my_view(request):
if request.method == 'POST':
form = MyForm(request.POST)
if form.is_valid():
field1 = form.cleaned_data['field']
# Do something...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment