Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Removed unused variable and changed comments about `permalink` decora…

…tor into a docstring.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 9a1c21809ed48b0d06c1e2395bf6a7c7b900f96a 1 parent 2679bc0
@gdub gdub authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 django/db/models/
14 django/db/models/
@@ -15,14 +15,18 @@
# Admin stages.
ADD, CHANGE, BOTH = 1, 2, 3
-# Decorator. Takes a function that returns a tuple in this format:
-# (viewname, viewargs, viewkwargs)
-# Returns a function that calls urlresolvers.reverse() on that data, to return
-# the URL for those parameters.
def permalink(func):
+ """
+ Decorator that calls urlresolvers.reverse() to return a URL using
+ parameters returned by the decorated function "func".
+ "func" should be a function that returns a tuple in one of the
+ following formats:
+ (viewname, viewargs)
+ (viewname, viewargs, viewkwargs)
+ """
from django.core.urlresolvers import reverse
def inner(*args, **kwargs):
bits = func(*args, **kwargs)
- viewname = bits[0]
return reverse(bits[0], None, *bits[1:3])
return inner

0 comments on commit 9a1c218

Please sign in to comment.
Something went wrong with that request. Please try again.