Skip to content

Instantly share code, notes, and snippets.

Created December 26, 2012 16:23
Show Gist options
  • Save anonymous/4381219 to your computer and use it in GitHub Desktop.
Save anonymous/4381219 to your computer and use it in GitHub Desktop.
from myapp.forms import MyForm
def my_view(request):
if request.method == "POST":
form = MyForm(request.POST)
if form.is_valid():
name = form.cleaned_data['name']
email = form.cleaned_data['email']
# do something great with that data
else:
form = MyForm()
return render(request, 'myapp/myform.html', {
'form': form
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment