Skip to content

Instantly share code, notes, and snippets.

@bmease
Created May 28, 2012 18:29
Show Gist options
  • Save bmease/2820527 to your computer and use it in GitHub Desktop.
Save bmease/2820527 to your computer and use it in GitHub Desktop.
Example formset
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