Module ImportFrom alias ImportFrom alias identifier Import alias ImportFrom alias ClassDef bases NameLoad body Expr Str Assign NameStore Str Assign NameStore TupleLoad Str Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad NameLoad body If BoolOpAnd NameLoad AttributeLoad NameLoad attr body Return Call AttributeLoad NameLoad attr keyword NameLoad Return NameLoad decorator_list Assign AttributeStore NameLoad attr Call NameLoad Str decorator_list Expr Call AttributeLoad NameLoad attr NameLoad NameLoad
N/A django.contrib.flatpages.models FlatPage django.utils.translation ugettext_lazy _ N/A authority authority.permissions BasePermission FlatPagePermission N/A BasePermission N/A N/A 
    This class contains a bunch of checks:
    
    1. the default checks 'add_flatpage', 'browse_flatpage',
       'change_flatpage' and 'delete_flatpage'
    2. the custom checks:
        a) 'review_flatpage', which is similar to the default checks
        b) 'top_secret', which is represented by the top_secret method

    You can use those checks in your views directly like::

        def review_flatpage(request, url):
            flatpage = get_object_or_404(url__contains=url)
            check = FlatPagePermission(request.user)
            if check.review_flatpage(obj=flatpage):
                print "yay, you can review this flatpage!"
            return flatpage(request, url)

    Or the same view using the decorator permission_required::

        @permission_required('flatpage_permission.review_flatpage',
            ('flatpages.flatpage', 'url__contains', 'url'))
        def review_flatpage(request, url):
            print "yay, you can review this flatpage!"
            return flatpage(request, url)

    Or you can use this permission in your templates like this::

        {% ifhasperm "flatpage_permission.review_flatpage" request.user flatpage %}
            Yes, you are allowed to review flatpage '{{ flatpage }}', aren't you?
        {% else %}
            Nope, sorry. You aren't allowed to review this flatpage.
        {% endifhasperm %}

     N/A label flatpage_permission N/A checks N/A review top_secret top_secret N/A N/A self flatpage lala N/A None None N/A N/A N/A flatpage N/A flatpage registration_required N/A N/A N/A N/A self browse_flatpage obj flatpage N/A False N/A N/A N/A top_secret short_description N/A _ Is allowed to see top secret flatpages N/A N/A N/A N/A authority register FlatPage FlatPagePermission