Removing trailing whitespace.

This commit is contained in:
Randall Degges 2011-02-21 09:01:43 -08:00
parent 2b86bd5232
commit 5f69581e17

View file

@ -25,12 +25,12 @@ A custom permission is a simple method of the permission class::
class FlatpagePermission(permissions.BasePermission):
label = 'flatpage_permission'
checks = ('my_custom_check',)
def my_custom_check(self, flatpage):
if(flatpage.url == '/about/'):
return True
return False
authority.register(Flatpage, FlatpagePermission)
Note that we first added the name of your custom permission to the ``checks``
@ -47,7 +47,7 @@ permission is True or False::
return True
return False
.. warning:: Although it's possible to return other values than ``True``, for
.. warning:: Although it's possible to return other values than ``True``, for
example an object which also evluates to True, we highly advise to only
return booleans.
@ -86,7 +86,7 @@ In your python code
::
from myapp.permissions import FlatPagePermission
def my_view(request):
def my_view(request):
check = FlatPagePermission(request.user)
flatpage_object = Flatpage.objects.get(url='/homepage/')
if check.my_custom_check(flatpage=flatpage_object):
@ -103,9 +103,9 @@ Using the view decorator
(Flatpage, 'url__iexact', 'url')) # The flatpage_object
def my_view(request, url):
# ...
See :ref:`check-decorator` how the decorator works in detail.
In your templates
-----------------
::