Skip to content

Commit fad9c7e

Browse files
committed
Merge pull request #84 from novafloss/improve-readme
[README] Switch from Markdown to ReST
2 parents db1346b + 35bb607 commit fad9c7e

File tree

2 files changed

+86
-69
lines changed

2 files changed

+86
-69
lines changed

README.md

Lines changed: 0 additions & 69 deletions
This file was deleted.

README.rst

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,88 @@
1+
=================
12
django-formidable
23
=================
4+
5+
django-formidable is a full django application allows you to create,
6+
edit, delete and use forms.
7+
8+
Warning
9+
=======
10+
11+
Python Compatibility : python2.7 (tox said it's compliant until
12+
python3.2, but I don't) Django compatibility : django1.8
13+
14+
It's not prod-ready for the moment, no version has been released on
15+
official Pypi.
16+
17+
Licence
18+
=======
19+
20+
MIT Licence
21+
22+
Quick-Start
23+
===========
24+
25+
Install
26+
-------
27+
28+
No release is available, but we can install it from github.
29+
30+
::
31+
32+
$ sudo pip install git+https://github.com/peopledoc/django-formidable.git
33+
34+
Configure
35+
---------
36+
37+
Define Roles
38+
~~~~~~~~~~~~
39+
40+
django-formidable allows to access a single form with different role.
41+
The same form can be rendered in different way. If you don't have to
42+
handle multiple roles you have to define at least a default role.
43+
44+
Define a method which returns a list of formidable.accesses.AccessObject
45+
46+
.. code-block:: python
47+
48+
def get_roles(self):
49+
return [
50+
AccessObject(id='padawan', label='Padawan'),
51+
AccessObject(id='jedi', label='Jedi')
52+
]
53+
54+
Fill the settings key
55+
56+
.. code-block:: python
57+
58+
FORMIDABLE_ACCESS_RIGHTS_LOADER = 'yourproject.access_rights.get_roles'
59+
60+
Get context
61+
~~~~~~~~~~~
62+
63+
While accessing a form for a specific role, you need to provide a way in
64+
order to get the which context to use.
65+
66+
``request`` and ``kwargs`` are fetch from view (self.request,
67+
self.kwargs)
68+
69+
.. code-block:: python
70+
71+
def get_context(request, kwargs):
72+
return request.user.user_type
73+
74+
Next fill the setting key ``FORMIDABLE_CONTEXT_LOADER``
75+
76+
.. code-block:: python
77+
78+
FORMIDABLE_CONTEXT_LOADER = 'yourprojects.access_rights.get_context'
79+
80+
Define URL's
81+
------------
82+
83+
URLs are defined in :mod:``formidable.urls``. You can load them with the
84+
following line:
85+
86+
.. code-block:: python
87+
88+
url(r'^api/', include('formidable.urls', namespace='formidable'))

0 commit comments

Comments
 (0)