|
@@ -1,3 +1,60 @@
|
1
|
1
|
# mycreole
|
2
|
2
|
|
3
|
|
-Django Library Mycreole
|
|
3
|
+With the django library mycreole, you are abel to use the creole language to create html output in your django application.
|
|
4
|
+
|
|
5
|
+## Integration
|
|
6
|
+
|
|
7
|
+Clone the library in your django application.
|
|
8
|
+
|
|
9
|
+### Configurations in your settings.py
|
|
10
|
+Add the following line to the list ```INSTALLED_APPS```:
|
|
11
|
+```
|
|
12
|
+'mycreole.apps.MycreoleConfig',
|
|
13
|
+```
|
|
14
|
+
|
|
15
|
+Define the folder, where the attachments are stored with the following line:
|
|
16
|
+```
|
|
17
|
+MYCREOLE_ROOT = os.path.join(BASE_DIR, 'data', 'pages')
|
|
18
|
+```
|
|
19
|
+
|
|
20
|
+Define the methods to grant or deny the access to the attachments by:
|
|
21
|
+```
|
|
22
|
+MYCREOLE_ATTACHMENT_ACCESS = {
|
|
23
|
+ 'read': 'pages.access.read_attachment',
|
|
24
|
+ 'modify': 'pages.access.modify_attachment',
|
|
25
|
+}
|
|
26
|
+```
|
|
27
|
+
|
|
28
|
+Define the methods to extend the navigationbar and menubar by this statement:
|
|
29
|
+```
|
|
30
|
+MYCREOLE_BAR = {
|
|
31
|
+ 'navibar': 'pages.context.navigationbar',
|
|
32
|
+ 'menubar': 'pages.context.menubar',
|
|
33
|
+}
|
|
34
|
+```
|
|
35
|
+
|
|
36
|
+## Usage
|
|
37
|
+### Creole help page
|
|
38
|
+In this example, you see a method in ```views.py``` which returns a creole help page:
|
|
39
|
+
|
|
40
|
+```
|
|
41
|
+from django.conf import settings
|
|
42
|
+from django.http import HttpResponse
|
|
43
|
+import mycreole
|
|
44
|
+import os
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+def help_on_creole(request):
|
|
48
|
+ attachment_path = os.path.join(settings.MYCREOLE_ROOT, 'creole_help_page')
|
|
49
|
+ html = mycreole.render(request, creole.help.MYCREOLE_HELP, self.attachment_path)
|
|
50
|
+```
|
|
51
|
+
|
|
52
|
+### Usage of next_achor
|
|
53
|
+TBD
|
|
54
|
+
|
|
55
|
+### Usage of macros
|
|
56
|
+You can give a dictonary as macros parameter to the render method, to define your own macros. Here an example of such a dict:
|
|
57
|
+```
|
|
58
|
+macros={
|
|
59
|
+ 'mymacro': method_to_be_called,
|
|
60
|
+}
|