@@ -30,17 +30,57 @@ $ pip install git+https://github.com/app-generator/django-dynamic-datatb.git
30
30
31
31
<br />
32
32
33
- > ** Step #2 ** - ` Update Configuration ` , include the new APPs
33
+ > ** Step #2 ** - Update Configuration, ` add new imports `
34
+
35
+ ``` python
36
+ import os, inspect
37
+ import django_dyn_dt
38
+ ```
39
+
40
+ <br />
41
+
42
+ > ** Step #3 ** - Update Configuration, ` include the new APPs `
34
43
35
44
``` python
36
45
INSTALLED_APPS = [
37
- ' django_dyn_dt' , # Django Dynamic Data tables # <-- NEW
46
+ ' django_dyn_dt' , # <-- NEW App
47
+ ]
48
+ ```
49
+
50
+ <br />
51
+
52
+ > ** Step #4 ** - Update Configuration, include the new ` TEMPLATES ` DIR
53
+
54
+ ``` python
55
+
56
+ TEMPLATE_DIR_DATATB = os.path.join(BASE_DIR , " django_dyn_dt/templates" ) # <-- NEW App
57
+
58
+ TEMPLATES = [
59
+ {
60
+ " BACKEND" : " django.template.backends.django.DjangoTemplates" ,
61
+ " DIRS" : [TEMPLATE_DIR_DATATB ], # <-- NEW Include
62
+ " APP_DIRS" : True ,
63
+ " OPTIONS" : {
64
+ },
65
+ },
38
66
]
39
67
```
40
68
41
69
<br />
42
70
43
- > ** Step #3 ** - ` Register the model ` in ` core/settings.py ` (DYNAMIC_API section)
71
+ > ** Step #5 ** - Update Configuration, update ` STATICFILES_DIRS ` DIR
72
+
73
+ ``` python
74
+ DYN_DB_PKG_ROOT = os.path.dirname( inspect.getfile( django_dyn_dt ) ) # <-- NEW App
75
+
76
+ STATICFILES_DIRS = (
77
+ os.path.join(DYN_DB_PKG_ROOT , " templates/static" ),
78
+ )
79
+ ```
80
+
81
+ <br />
82
+
83
+ > ** Step #6 ** - ` Register the model ` in ` core/settings.py ` (DYNAMIC_DATATB section)
44
84
45
85
This sample code assumes that ` app1 ` exists and model ` Book ` is defined and migrated.
46
86
@@ -55,16 +95,8 @@ DYNAMIC_DATATB = {
55
95
56
96
<br />
57
97
58
- > ** Step #4 ** - ` Migrate DB `
59
-
60
- ``` bash
61
- $ python manage.py makemigrations
62
- $ python manage.py migrate
63
- ```
64
-
65
- <br />
66
98
67
- > ** Step #5 ** - ` Update routing ` , include APIs
99
+ > ** Step #7 ** - ` Update routing ` , include APIs
68
100
69
101
``` python
70
102
from django.contrib import admin
@@ -78,7 +110,7 @@ urlpatterns = [
78
110
79
111
<br />
80
112
81
- > ** Step #7 ** - Use the Dynamic Datatable module
113
+ > ** Step #8 ** - Use the Dynamic Datatable module
82
114
83
115
If the managed model is ` Books ` , the dynamic interface is ` /datatb/books/ ` and all features available.
84
116
0 commit comments