Skip to content

Instantly share code, notes, and snippets.

@alex
Forked from toastdriven/why_render_to_response.py
Created October 28, 2010 16:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex/651678 to your computer and use it in GitHub Desktop.
Save alex/651678 to your computer and use it in GitHub Desktop.
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from myapp.models import Note
def note_detail(request, slug):
note = get_object_or_404(Note, slug=slug)
editable = request.user.is_authenticated and request.user.id == note.author.id
return render_to_response('myapp/note_detail.html', {
'note': note,
'editable': editable,
}, context_instance=RequestContext(request))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment