Kai Diefenbach avatar Kai Diefenbach committed ba340e7

Updated docs

Comments (0)

Files changed (6)

 *parts/
 *bin/
 *downloads/
-*docs/_build
+*docs/_build
+*dist
   .. autofunction:: register_group
   .. autofunction:: unregister_group
 
+Template tags
+=============
+
+**ifhasperm**
+
+Checks whether the current user has passed permission::
+
+    {% ifhasperm view %}
+        <span>Has permission</span>
+    {% else %}
+        <span>Doesn't have permission</span>
+    {% endifhasperm %}    
+
 Models
 ======
 
-This models can be found in ``permissions.models``.
-
 .. autoclass:: permissions.models.Permission
 .. autoclass:: permissions.models.ObjectPermission
 .. autoclass:: permissions.models.ObjectPermissionInheritanceBlock
 .. toctree::
    :maxdepth: 1
    
-   overview.rst
+   installation.rst
+   usage.rst
    api.rst
 
 Indices and tables

docs/installation.rst

+============
+Installation
+============
+
+To install django-permission, proceed as following:
+
+1. Easy install it: ``$ easy_install django-permissions``
+2. Add `permissions` to `INSTALLED_APPS` within `settings.py` of your django 
+   project.
+3. Sync your database: ``$ django-admin syncdb``

docs/overview.rst

-========
-Overview
-========
-
-.. warning::
-
-    django-permissions is in alpha state. Please consider the API as supposed 
-    to be changed until it reaches beta state.
-
-What is it?
-===========
-
-django-permissions provides generic per-object permissions for Django.
-
-How does it work?
-=================
-
-Create a new permission
------------------------
-
-.. code-block:: python
-
-    from permissions.utils import register_permission
-    permission = register_permission("View", "view")
-
-Create a new group
-------------------
-
-.. code-block:: python
-
-    from permissions.utils import register_group
-    brights = register_group("Brights")
-    
-This will create a default Django group.
-
-Create a FlatPage
------------------
-
-.. code-block:: python
-
-    from django.contrib.flatpages.models import FlatPage
-    content = FlatPage.objects.create(title="Example", url="example")
-
-Grant permission
-----------------
-
-.. code-block:: python
-
-    from permission.utils import grant_permission
-    grant_permission("view", brights, content)
-
-Now all users which are member of the group "Brights" have the permission to
-view object "content". You can also grant permission to single users.
-
-Check permission
-----------------
-
-.. code-block:: python
-
-    from permission.utils import has_permission
-    result = has_permission("view", request.user, content)
-
-    if result == False:
-        print "Alert!"
-
-This will check whether the current user has the permission "View" for the 
-FlatPage "content"
+=====
+Usage
+=====
+
+.. warning::
+
+    django-permissions is in alpha state. Please consider the API as supposed 
+    to be changed until it reaches beta state.
+
+Create a new permission
+-----------------------
+
+.. code-block:: python
+
+    from permissions.utils import register_permission
+    permission = register_permission("View", "view")
+
+Create a new group
+------------------
+
+.. code-block:: python
+
+    from permissions.utils import register_group
+    brights = register_group("Brights")
+    
+This will create a default Django group.
+
+Create a FlatPage
+-----------------
+
+.. code-block:: python
+
+    from django.contrib.flatpages.models import FlatPage
+    content = FlatPage.objects.create(title="Example", url="example")
+
+Grant permission
+----------------
+
+.. code-block:: python
+
+    from permission.utils import grant_permission
+    grant_permission("view", brights, content)
+
+Now all users which are member of the group "Brights" have the permission to
+view object "content". You can also grant permission to single users.
+
+Check permission
+----------------
+
+.. code-block:: python
+
+    from permission.utils import has_permission
+    result = has_permission("view", request.user, content)
+
+    if result == False:
+        print "Alert!"
+
+This will check whether the current user has the permission "View" for the 
+FlatPage "content".
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.