Skip to content

Instantly share code, notes, and snippets.

@toastdriven
Created October 28, 2010 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save toastdriven/650717 to your computer and use it in GitHub Desktop.
Save toastdriven/650717 to your computer and use it in GitHub Desktop.
For Luke.
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 = False
if request.user.is_authenticated:
if request.user.id == note.author.id:
editable = True
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