Created
June 14, 2012 01:42
-
-
Save SmileyChris/2927652 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_form_kwargs(request): | |
""" | |
A simple helper which returns the correct kwargs when a POST request is | |
used. | |
Usage:: | |
form = MyForm(**get_form_kwargs(request)) | |
if form.is_valid(): | |
... | |
""" | |
if request.method == 'POST': | |
return {'data': request.POST, 'files': request.FILES} | |
return {'data': None, 'files': None} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment