Created
May 28, 2012 18:29
-
-
Save bmease/2820527 to your computer and use it in GitHub Desktop.
Example formset
This file contains 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 liquid_comment_add(request, liquid_id): | |
liquid = get_object_or_404(Liquid, pk=liquid_id) | |
if request.method == "POST": | |
formset = CommentForm(request.POST) | |
if formset.is_valid(): | |
liquid.comments.create( | |
text = formset.cleaned_data['text'], | |
user = request.user | |
) | |
if request.user.is_authenticated(): | |
commentset = CommentForm() | |
return render_to_response( | |
'reviews/liquid.html', | |
{ | |
'liquid': liquid, | |
'commentset': commentset | |
}, | |
context_instance=RequestContext(request)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment