|
1 | | -# django-dynamic-datatb |
| 1 | +# [Django Dynamic DataTables](https://github.com/app-generator/django-dynamic-datatb) |
| 2 | + |
| 3 | +Simple tool that **Generates Secure APIs** on top of `DRF` with minimum effort - actively supported by [AppSeed](https://appseed.us/). |
| 4 | + |
| 5 | +<br /> |
| 6 | + |
| 7 | +> Features |
| 8 | +
|
| 9 | +- `DataTables` provided by `Simple DataTables` |
| 10 | +- `Minimal Configuration` (single line in config for each model) |
| 11 | +- `Handles any model` defined across the project |
| 12 | + |
| 13 | +<br /> |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +<br /> |
| 18 | + |
| 19 | +## How to use it |
| 20 | + |
| 21 | +<br /> |
| 22 | + |
| 23 | +> **Step #1** - `Install the package` |
| 24 | +
|
| 25 | +```bash |
| 26 | +$ pip install django-dynamic-datatb |
| 27 | +// OR |
| 28 | +$ pip install git+https://github.com/app-generator/django-dynamic-datatb.git |
| 29 | +``` |
| 30 | + |
| 31 | +<br /> |
| 32 | + |
| 33 | +> **Step #2** - `Update Configuration`, include the new APPs |
| 34 | +
|
| 35 | +```python |
| 36 | +INSTALLED_APPS = [ |
| 37 | + 'django_dyn_dt', # Django Dynamic Data tables # <-- NEW |
| 38 | +] |
| 39 | +``` |
| 40 | + |
| 41 | +<br /> |
| 42 | + |
| 43 | +> **Step #3** - `Register the model` in `core/settings.py` (DYNAMIC_API section) |
| 44 | +
|
| 45 | +This sample code assumes that `app1` exists and model `Book` is defined and migrated. |
| 46 | + |
| 47 | +```python |
| 48 | + |
| 49 | +DYNAMIC_DATATB = { |
| 50 | + # SLUG -> Import_PATH |
| 51 | + 'books' : "app1.models.Book", |
| 52 | +} |
| 53 | + |
| 54 | +``` |
| 55 | + |
| 56 | +<br /> |
| 57 | + |
| 58 | +> **Step #4** - `Migrate DB` |
| 59 | +
|
| 60 | +```bash |
| 61 | +$ python manage.py makemigrations |
| 62 | +$ python manage.py migrate |
| 63 | +``` |
| 64 | + |
| 65 | +<br /> |
| 66 | + |
| 67 | +> **Step #5** - `Update routing`, include APIs |
| 68 | +
|
| 69 | +```python |
| 70 | +from django.contrib import admin |
| 71 | +from django.urls import path, include # <-- NEW: 'include` directive added |
| 72 | + |
| 73 | +urlpatterns = [ |
| 74 | + path("admin/", admin.site.urls), |
| 75 | + path('', include('django_dyn_dt.urls')), # <-- NEW: API routing rules |
| 76 | +] |
| 77 | +``` |
| 78 | + |
| 79 | +<br /> |
| 80 | + |
| 81 | +> **Step #7** - Use the Dynamic Datatable module |
| 82 | +
|
| 83 | +If the managed model is `Books`, the dynamic interface is `/datatb/books/` and all features available. |
| 84 | + |
| 85 | +<br /> |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +<br /> |
| 90 | + |
| 91 | +### Links & resources |
| 92 | + |
| 93 | +- [DRF](https://www.django-rest-framework.org/) - HOMEpage |
| 94 | +- More [Developer Tools](https://appseed.us/developer-tools/) provided by `AppSeed` |
| 95 | +- Ask for [Support](https://appseed.us/support/) via `Email` & `Discord` |
| 96 | + |
| 97 | +<br /> |
| 98 | + |
| 99 | +--- |
| 100 | +[Django Dynamic DataTables](https://github.com/app-generator/django-dynamic-datatb) - Open-source library provided by **[AppSeed](https://appseed.us/)** |
0 commit comments