django-microsys 1.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_microsys-1.5.2/LICENSE +21 -0
- django_microsys-1.5.2/MANIFEST.in +19 -0
- django_microsys-1.5.2/PKG-INFO +413 -0
- django_microsys-1.5.2/README.md +381 -0
- django_microsys-1.5.2/django_microsys.egg-info/PKG-INFO +413 -0
- django_microsys-1.5.2/django_microsys.egg-info/SOURCES.txt +128 -0
- django_microsys-1.5.2/django_microsys.egg-info/dependency_links.txt +1 -0
- django_microsys-1.5.2/django_microsys.egg-info/requires.txt +6 -0
- django_microsys-1.5.2/django_microsys.egg-info/top_level.txt +1 -0
- django_microsys-1.5.2/microsys/__init__.py +0 -0
- django_microsys-1.5.2/microsys/admin.py +46 -0
- django_microsys-1.5.2/microsys/api.py +98 -0
- django_microsys-1.5.2/microsys/apps.py +90 -0
- django_microsys-1.5.2/microsys/context_processors.py +160 -0
- django_microsys-1.5.2/microsys/discovery.py +213 -0
- django_microsys-1.5.2/microsys/fetcher.py +288 -0
- django_microsys-1.5.2/microsys/filters.py +173 -0
- django_microsys-1.5.2/microsys/forms.py +654 -0
- django_microsys-1.5.2/microsys/management/commands/__init__.py +0 -0
- django_microsys-1.5.2/microsys/management/commands/microsys_check.py +172 -0
- django_microsys-1.5.2/microsys/management/commands/microsys_setup.py +53 -0
- django_microsys-1.5.2/microsys/managers.py +57 -0
- django_microsys-1.5.2/microsys/middleware.py +32 -0
- django_microsys-1.5.2/microsys/migrations/0001_initial.py +86 -0
- django_microsys-1.5.2/microsys/migrations/__init__.py +0 -0
- django_microsys-1.5.2/microsys/models.py +136 -0
- django_microsys-1.5.2/microsys/signals.py +178 -0
- django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap-icons.css +1390 -0
- django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap-icons.woff +0 -0
- django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap-icons.woff2 +0 -0
- django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap.bundle.min.js +7 -0
- django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap.bundle.min.js.map +1 -0
- django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap.rtl.min.css +6 -0
- django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap.rtl.min.css.map +1 -0
- django_microsys-1.5.2/microsys/static/flatpickr/flatpickr.min.css +13 -0
- django_microsys-1.5.2/microsys/static/flatpickr/flatpickr.min.js +2 -0
- django_microsys-1.5.2/microsys/static/flatpickr/locale/ar.d.ts +72 -0
- django_microsys-1.5.2/microsys/static/flatpickr/locale/ar.js +62 -0
- django_microsys-1.5.2/microsys/static/img/base_logo.webp +0 -0
- django_microsys-1.5.2/microsys/static/img/default_profile.webp +0 -0
- django_microsys-1.5.2/microsys/static/img/login_logo.webp +0 -0
- django_microsys-1.5.2/microsys/static/main/css/accessibility.css +94 -0
- django_microsys-1.5.2/microsys/static/main/css/buttons.css +116 -0
- django_microsys-1.5.2/microsys/static/main/css/charts.css +44 -0
- django_microsys-1.5.2/microsys/static/main/css/doc_detail.css +101 -0
- django_microsys-1.5.2/microsys/static/main/css/dropdowns.css +53 -0
- django_microsys-1.5.2/microsys/static/main/css/gen_pdf.css +126 -0
- django_microsys-1.5.2/microsys/static/main/css/gen_report.css +74 -0
- django_microsys-1.5.2/microsys/static/main/css/index_cards.css +164 -0
- django_microsys-1.5.2/microsys/static/main/css/main.css +294 -0
- django_microsys-1.5.2/microsys/static/main/css/navtabs.css +49 -0
- django_microsys-1.5.2/microsys/static/main/css/pagination.css +35 -0
- django_microsys-1.5.2/microsys/static/main/css/tables.css +119 -0
- django_microsys-1.5.2/microsys/static/main/css/titlebar.css +58 -0
- django_microsys-1.5.2/microsys/static/main/fonts/Amiri-Bold.woff2 +0 -0
- django_microsys-1.5.2/microsys/static/main/fonts/Amiri-BoldItalic.woff2 +0 -0
- django_microsys-1.5.2/microsys/static/main/fonts/Amiri-Italic.woff2 +0 -0
- django_microsys-1.5.2/microsys/static/main/fonts/Amiri-Regular.woff2 +0 -0
- django_microsys-1.5.2/microsys/static/main/fonts/Shabwa-Bold.woff2 +0 -0
- django_microsys-1.5.2/microsys/static/main/fonts/Shabwa-Medium.woff2 +0 -0
- django_microsys-1.5.2/microsys/static/main/fonts/Shabwa.woff2 +0 -0
- django_microsys-1.5.2/microsys/static/main/js/accessibility.js +79 -0
- django_microsys-1.5.2/microsys/static/main/js/anime.min.js +8 -0
- django_microsys-1.5.2/microsys/static/main/js/autofill.js +184 -0
- django_microsys-1.5.2/microsys/static/main/js/plotly-basic.min.js +47 -0
- django_microsys-1.5.2/microsys/static/main/js/plotly-locale-ar.js +1 -0
- django_microsys-1.5.2/microsys/static/main/js/scan_button.js +109 -0
- django_microsys-1.5.2/microsys/static/main/js/scanlink.js +343 -0
- django_microsys-1.5.2/microsys/static/sections/css/context_menu.css +80 -0
- django_microsys-1.5.2/microsys/static/sections/js/context_menu.js +687 -0
- django_microsys-1.5.2/microsys/static/sidebar/css/reorder.css +91 -0
- django_microsys-1.5.2/microsys/static/sidebar/css/theme_picker.css +165 -0
- django_microsys-1.5.2/microsys/static/sidebar/js/reorder.js +267 -0
- django_microsys-1.5.2/microsys/static/sidebar/js/theme_picker.js +58 -0
- django_microsys-1.5.2/microsys/static/sidebar/sidebar.css +232 -0
- django_microsys-1.5.2/microsys/static/sidebar/sidebar.js +140 -0
- django_microsys-1.5.2/microsys/static/themes/blue.css +52 -0
- django_microsys-1.5.2/microsys/static/themes/dark.css +552 -0
- django_microsys-1.5.2/microsys/static/themes/gold.css +52 -0
- django_microsys-1.5.2/microsys/static/themes/green.css +64 -0
- django_microsys-1.5.2/microsys/static/themes/light.css +52 -0
- django_microsys-1.5.2/microsys/static/themes/main.css +6 -0
- django_microsys-1.5.2/microsys/static/themes/main.js +41 -0
- django_microsys-1.5.2/microsys/static/themes/red.css +52 -0
- django_microsys-1.5.2/microsys/static/tutorial/driver.js +2 -0
- django_microsys-1.5.2/microsys/static/tutorial/tutorial.css +147 -0
- django_microsys-1.5.2/microsys/static/tutorial/tutorial.js +297 -0
- django_microsys-1.5.2/microsys/static/users/css/login.css +273 -0
- django_microsys-1.5.2/microsys/static/users/css/permissions.css +105 -0
- django_microsys-1.5.2/microsys/static/users/css/profile.css +123 -0
- django_microsys-1.5.2/microsys/static/users/js/login.js +15 -0
- django_microsys-1.5.2/microsys/static/users/js/manage_users.js +191 -0
- django_microsys-1.5.2/microsys/static/users/js/permissions.js +94 -0
- django_microsys-1.5.2/microsys/static/users/js/user_activity_log.js +9 -0
- django_microsys-1.5.2/microsys/tables.py +75 -0
- django_microsys-1.5.2/microsys/templates/includes/autofill_toggle.html +32 -0
- django_microsys-1.5.2/microsys/templates/includes/scan.html +3 -0
- django_microsys-1.5.2/microsys/templates/includes/sidebar_items.html +7 -0
- django_microsys-1.5.2/microsys/templates/includes/titlebar.html +64 -0
- django_microsys-1.5.2/microsys/templates/includes/tutorial.html +6 -0
- django_microsys-1.5.2/microsys/templates/microsys/base.html +117 -0
- django_microsys-1.5.2/microsys/templates/microsys/dashboard.html +83 -0
- django_microsys-1.5.2/microsys/templates/microsys/options.html +250 -0
- django_microsys-1.5.2/microsys/templates/microsys/profile/profile.html +114 -0
- django_microsys-1.5.2/microsys/templates/microsys/profile/profile_edit.html +100 -0
- django_microsys-1.5.2/microsys/templates/microsys/scopes/scope_actions.html +9 -0
- django_microsys-1.5.2/microsys/templates/microsys/scopes/scope_form.html +19 -0
- django_microsys-1.5.2/microsys/templates/microsys/scopes/scope_manager.html +12 -0
- django_microsys-1.5.2/microsys/templates/microsys/sections/manage_sections.html +224 -0
- django_microsys-1.5.2/microsys/templates/microsys/sections/subsection_select.html +95 -0
- django_microsys-1.5.2/microsys/templates/microsys/user_activity_log.html +31 -0
- django_microsys-1.5.2/microsys/templates/microsys/users/grouped_permissions.html +79 -0
- django_microsys-1.5.2/microsys/templates/microsys/users/manage_users.html +132 -0
- django_microsys-1.5.2/microsys/templates/microsys/users/user_actions.html +34 -0
- django_microsys-1.5.2/microsys/templates/microsys/users/user_detail.html +108 -0
- django_microsys-1.5.2/microsys/templates/microsys/users/user_form.html +37 -0
- django_microsys-1.5.2/microsys/templates/registration/login.html +62 -0
- django_microsys-1.5.2/microsys/templates/sidebar/auto.html +15 -0
- django_microsys-1.5.2/microsys/templates/sidebar/extra_groups.html +34 -0
- django_microsys-1.5.2/microsys/templates/sidebar/main.html +133 -0
- django_microsys-1.5.2/microsys/templatetags/__init__.py +1 -0
- django_microsys-1.5.2/microsys/templatetags/sidebar_tags.py +74 -0
- django_microsys-1.5.2/microsys/tests/__init__.py +0 -0
- django_microsys-1.5.2/microsys/tests/test_utils_discovery.py +24 -0
- django_microsys-1.5.2/microsys/urls.py +52 -0
- django_microsys-1.5.2/microsys/utils.py +661 -0
- django_microsys-1.5.2/microsys/views.py +1289 -0
- django_microsys-1.5.2/pyproject.toml +56 -0
- django_microsys-1.5.2/setup.cfg +4 -0
- django_microsys-1.5.2/setup.py +41 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 DeBeski
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Include the README so PyPI shows your long description
|
|
2
|
+
include README.md
|
|
3
|
+
|
|
4
|
+
# Include the license
|
|
5
|
+
include LICENSE
|
|
6
|
+
|
|
7
|
+
# Include all files inside the users package
|
|
8
|
+
recursive-include microsys *
|
|
9
|
+
|
|
10
|
+
# If you have templates inside the users app
|
|
11
|
+
recursive-include microsys/templates *
|
|
12
|
+
|
|
13
|
+
# If you have static files
|
|
14
|
+
recursive-include microsys/static *
|
|
15
|
+
|
|
16
|
+
# Make sure no unnecessary Python cache files are included
|
|
17
|
+
exclude *.pyc
|
|
18
|
+
exclude __pycache__/
|
|
19
|
+
recursive-exclude * __pycache__ *.pyc *.pyo
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: django_microsys
|
|
3
|
+
Version: 1.5.2
|
|
4
|
+
Summary: Django micro (System Integration Service) - an RTL Django Starter Pack, Packed with Features.
|
|
5
|
+
Home-page: https://github.com/debeski/django-microsys
|
|
6
|
+
Author: DeBeski
|
|
7
|
+
Author-email: DeBeski <debeski1@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/debeski/django-microsys
|
|
10
|
+
Keywords: django,microsys,permissions,authentication
|
|
11
|
+
Classifier: Framework :: Django
|
|
12
|
+
Classifier: Framework :: Django :: 5
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: Django>=5.1
|
|
27
|
+
Requires-Dist: django-crispy-forms>=2.4
|
|
28
|
+
Requires-Dist: django-tables2>=2.7
|
|
29
|
+
Requires-Dist: django-filter>=24.3
|
|
30
|
+
Requires-Dist: pillow>=11.0
|
|
31
|
+
Requires-Dist: babel>=2.1
|
|
32
|
+
|
|
33
|
+
# micro - System Integration Service
|
|
34
|
+
|
|
35
|
+
[](https://pypi.org/project/django-microsys/)
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<img src="https://github.com/debeski/django-microsys/blob/2e3b7007f07d7265b9e70a44bd388bddf137f811/microsys/static/img/login_logo.webp" alt="microSys Logo" width="450"/>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
**Arabic** lightweight, reusable Django app providing comprehensive system integration services, including user management, profile extension, permissions, localization, dynamic sidebar, automated activity logging and more.
|
|
42
|
+
|
|
43
|
+
## Requirements
|
|
44
|
+
- Python 3.11+
|
|
45
|
+
- Django 5.2+
|
|
46
|
+
- django-crispy-forms 2.4+
|
|
47
|
+
- crispy-bootstrap5 2025.5+
|
|
48
|
+
- django-tables2 2.8+
|
|
49
|
+
- django-filter 25+
|
|
50
|
+
- django-health-check 3.20+
|
|
51
|
+
- babel 2.1+
|
|
52
|
+
- psutil
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
- **System Integration**: Centralized management for users and system scopes.
|
|
56
|
+
- **Profile Extension**: Automatically links a `Profile` to your existing User model.
|
|
57
|
+
- **Scope Management**: Optional, dynamic scope isolation system with abstract `ScopedModel`.
|
|
58
|
+
- **Dynamic Sidebar**: Auto-discovery of list views and customizable menu items.
|
|
59
|
+
- **Permissions**: Custom grouped permission UI (App/Model/Action).
|
|
60
|
+
- **Automated Logging**: Full activity tracking (CRUD, Login/Logout) via Signals.
|
|
61
|
+
- **Localization**: Native Arabic support for all interfaces.
|
|
62
|
+
- **Theming & Accessibility**: Built-in dark/light modes and accessibility tools (High Contrast, Zoom, etc.).
|
|
63
|
+
- **Security**: CSP compliance, role-based access control (RBAC).
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install git+https://github.com/debeski/django-microsys.git
|
|
69
|
+
# OR
|
|
70
|
+
pip install django-microsys
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Quick Start & Configuration
|
|
74
|
+
|
|
75
|
+
1. **Add to `INSTALLED_APPS`:**
|
|
76
|
+
```python
|
|
77
|
+
INSTALLED_APPS = [
|
|
78
|
+
'django.contrib.admin',
|
|
79
|
+
'django.contrib.auth',
|
|
80
|
+
# ... dependencies
|
|
81
|
+
'crispy_forms',
|
|
82
|
+
'crispy_bootstrap5',
|
|
83
|
+
'django_filters',
|
|
84
|
+
'django_tables2',
|
|
85
|
+
|
|
86
|
+
'microsys', # Place anywhere.
|
|
87
|
+
]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
2. **Add Middleware:**
|
|
91
|
+
Required for activity logging and request caching.
|
|
92
|
+
```python
|
|
93
|
+
MIDDLEWARE = [
|
|
94
|
+
# ...
|
|
95
|
+
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
96
|
+
# ... Must be below Auth Middleware
|
|
97
|
+
'microsys.middleware.ActivityLogMiddleware',
|
|
98
|
+
]
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
3. **Add Context Processor:**
|
|
102
|
+
Unified context processor for branding, sidebar, and scope settings.
|
|
103
|
+
```python
|
|
104
|
+
TEMPLATES = [
|
|
105
|
+
{
|
|
106
|
+
# ...
|
|
107
|
+
'OPTIONS': {
|
|
108
|
+
'context_processors': [
|
|
109
|
+
# ...
|
|
110
|
+
'microsys.context_processors.microsys_context',
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
4. **Include URLs:**
|
|
118
|
+
Mount at **root** for seamless Django auth integration:
|
|
119
|
+
```python
|
|
120
|
+
from django.urls import path, include
|
|
121
|
+
|
|
122
|
+
urlpatterns = [
|
|
123
|
+
# ...
|
|
124
|
+
path('', include('microsys.urls')), # Mount at root
|
|
125
|
+
]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This provides:
|
|
129
|
+
- `/accounts/login/` and `/accounts/logout/` (Django defaults)
|
|
130
|
+
- `/sys/` for all system management routes
|
|
131
|
+
|
|
132
|
+
> ⚠️ **Warning:** If your project already uses `/accounts/` URLs (e.g., `django-allauth`), you'll have conflicts. In that case, mount with a prefix and configure custom auth URLs:
|
|
133
|
+
> ```python
|
|
134
|
+
> # urls.py
|
|
135
|
+
> path('microsys/', include('microsys.urls')),
|
|
136
|
+
>
|
|
137
|
+
> # settings.py
|
|
138
|
+
> LOGIN_URL = '/microsys/accounts/login/'
|
|
139
|
+
> LOGIN_REDIRECT_URL = '/microsys/sys/'
|
|
140
|
+
> LOGOUT_REDIRECT_URL = '/microsys/accounts/login/'
|
|
141
|
+
> ```
|
|
142
|
+
|
|
143
|
+
5. **Run Setup Command:**
|
|
144
|
+
```bash
|
|
145
|
+
python manage.py microsys_setup
|
|
146
|
+
```
|
|
147
|
+
This will create migrations, apply them, and validate your configuration.
|
|
148
|
+
|
|
149
|
+
## Management Commands
|
|
150
|
+
|
|
151
|
+
### `microsys_setup`
|
|
152
|
+
Initial setup command that handles migrations and configuration validation.
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Full setup (recommended for first install)
|
|
156
|
+
python manage.py microsys_setup
|
|
157
|
+
|
|
158
|
+
# Skip configuration check
|
|
159
|
+
python manage.py microsys_setup --skip-check
|
|
160
|
+
|
|
161
|
+
# Only validate config (skip migrations)
|
|
162
|
+
python manage.py microsys_setup --no-migrate
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### `microsys_check`
|
|
166
|
+
Validates your Django settings and shows exact code snippets for any missing configuration.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
python manage.py microsys_check
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Output example:**
|
|
173
|
+
```
|
|
174
|
+
🔍 MicroSys Configuration Check
|
|
175
|
+
==================================================
|
|
176
|
+
|
|
177
|
+
📋 INSTALLED_APPS: ✓ OK
|
|
178
|
+
📋 MIDDLEWARE: ✗ MISSING
|
|
179
|
+
📋 CONTEXT_PROCESSORS: ✓ OK
|
|
180
|
+
📋 URLS: ✓ OK
|
|
181
|
+
📋 CRISPY_FORMS: ✓ OK
|
|
182
|
+
|
|
183
|
+
==================================================
|
|
184
|
+
❌ REQUIRED CONFIGURATION MISSING:
|
|
185
|
+
|
|
186
|
+
▶ MIDDLEWARE:
|
|
187
|
+
|
|
188
|
+
MIDDLEWARE = [
|
|
189
|
+
# ... after AuthenticationMiddleware
|
|
190
|
+
'microsys.middleware.ActivityLogMiddleware',
|
|
191
|
+
]
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
> **Note:** microsys also validates your configuration at runtime and will emit warnings if required middleware or context processors are missing.
|
|
195
|
+
|
|
196
|
+
## App Configuration
|
|
197
|
+
|
|
198
|
+
Customize branding and behavior by adding `MICROSYS_CONFIG` and `SIDEBAR_AUTO` to your `settings.py`:
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
MICROSYS_CONFIG = {
|
|
202
|
+
'name': 'My System Name', # App title in navbar/pages
|
|
203
|
+
'verbose_name': 'ادارة النظام', # App title in navbar/pages
|
|
204
|
+
'logo': '/static/img/logo.png', # Base/logo shown in the titlebar
|
|
205
|
+
'login_logo': '/static/img/login_logo.webp', # Logo on login screen
|
|
206
|
+
'description': 'System Desc', # Optional description
|
|
207
|
+
'home_url': '/sys/', # Titlebar home link (default: /sys/)
|
|
208
|
+
|
|
209
|
+
# ... branding fields only
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
# Auth redirects (defaults are set by microsys if not provided)
|
|
213
|
+
LOGIN_REDIRECT_URL = '/sys/'
|
|
214
|
+
LOGOUT_REDIRECT_URL = '/accounts/login/'
|
|
215
|
+
|
|
216
|
+
SIDEBAR_AUTO = {
|
|
217
|
+
'ENABLED': True, # Enable auto-discovery
|
|
218
|
+
'URL_PATTERNS': ['list'], # Keywords to match in URL names for auto-menu
|
|
219
|
+
'EXCLUDE_APPS': ['admin', 'auth'], # Apps to exclude
|
|
220
|
+
'CACHE_TIMEOUT': 3600, # Cache timeout in seconds
|
|
221
|
+
'DEFAULT_ICON': 'bi-list', # Default Bootstrap icon
|
|
222
|
+
|
|
223
|
+
# Built-in system group (accordion) can be disabled if desired
|
|
224
|
+
'SYSTEM_GROUP_ENABLED': True,
|
|
225
|
+
|
|
226
|
+
# Override auto-discovered items
|
|
227
|
+
'DEFAULT_ITEMS': {
|
|
228
|
+
'decree_list': { # Key is the URL name
|
|
229
|
+
'label': 'Decisions', # Override label
|
|
230
|
+
'icon': 'bi-gavel', # Override icon
|
|
231
|
+
'order': 10, # Sort order
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
# Add manual items (e.g. for views without models)
|
|
236
|
+
'EXTRA_ITEMS': {
|
|
237
|
+
'الإدارة': { # Accordion Group Name
|
|
238
|
+
'icon': 'bi-gear',
|
|
239
|
+
'items': [
|
|
240
|
+
{
|
|
241
|
+
'url_name': 'manage_sections',
|
|
242
|
+
'label': 'إدارة الأقسام',
|
|
243
|
+
'icon': 'bi-diagram-3',
|
|
244
|
+
'permission': 'is_staff',
|
|
245
|
+
},
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Core Components Usage
|
|
253
|
+
|
|
254
|
+
### 1. Profile Access
|
|
255
|
+
`microsys` automatically creates a `Profile` for every user via signals.
|
|
256
|
+
```python
|
|
257
|
+
# Accessing profile data
|
|
258
|
+
phone = user.profile.phone
|
|
259
|
+
scope = user.profile.scope
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### 2. ScopedModel (Data Isolation)
|
|
263
|
+
To enable automatic scope filtering and soft-delete, **YOUR MODELS MUST** inherit from:
|
|
264
|
+
```python
|
|
265
|
+
from microsys.models import ScopedModel
|
|
266
|
+
|
|
267
|
+
class MyModel(ScopedModel):
|
|
268
|
+
name = models.CharField(...)
|
|
269
|
+
# ...
|
|
270
|
+
```
|
|
271
|
+
- **Automatic Scope Recognition**: `ScopedModel` already uses global scope settings, so you don't need to do anything.
|
|
272
|
+
- **Automatic Filtering**: Queries are automatically filtered by the current user's scope.
|
|
273
|
+
- **Soft Delete**: `MyModel.objects.get(pk=1).delete()` sets `deleted_at` instead of removing the row.
|
|
274
|
+
|
|
275
|
+
### 3. Sidebar Features
|
|
276
|
+
- **Auto-Discovery**: Automatically finds views like `*_list` and adds them to the sidebar.
|
|
277
|
+
- **Toggle**: Users can collapse/expand the sidebar; preference is saved in the session.
|
|
278
|
+
- **Reordering**: Drag-and-drop reordering is supported for authorized users.
|
|
279
|
+
|
|
280
|
+
### 4. Themes & Accessibility
|
|
281
|
+
Built-in support for:
|
|
282
|
+
- **Themes**: Dark / Light and colors.
|
|
283
|
+
- **Accessibility Modes**:
|
|
284
|
+
- High Contrast
|
|
285
|
+
- Grayscale
|
|
286
|
+
- Invert Colors
|
|
287
|
+
- x1.5 Zoom
|
|
288
|
+
- Disable Animations
|
|
289
|
+
- **Location**: Accessible via the User Options menu (`options.html`) and Sidebar toolbar.
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Dynamic Section Mode
|
|
294
|
+
|
|
295
|
+
Microsys offers a powerful "Zero-Boilerplate" CRUD interface for managing auxiliary data models (like Departments, Categories, etc.).
|
|
296
|
+
|
|
297
|
+
### How It Works
|
|
298
|
+
1. **Mark Your Model**: Add `is_section = True` to your model (or Meta class).
|
|
299
|
+
```python
|
|
300
|
+
class Department(ScopedModel):
|
|
301
|
+
name = models.CharField(...)
|
|
302
|
+
is_section = True
|
|
303
|
+
```
|
|
304
|
+
2. **Auto-Discovery**: The system automatically generates a management UI with:
|
|
305
|
+
- Searchable Table (with pagination & sorting)
|
|
306
|
+
- Add/Edit Modals (using Crispy Forms)
|
|
307
|
+
- Delete protection (checks for related records)
|
|
308
|
+
- Filters (Keyword search + Date ranges if applicable)
|
|
309
|
+
|
|
310
|
+
> **Note**: You can customize the auto-generated components by adding `form_exclude` and `table_exclude` lists to your model:
|
|
311
|
+
> ```python
|
|
312
|
+
> class Department(ScopedModel):
|
|
313
|
+
> # ...
|
|
314
|
+
> form_exclude = ['internal_notes']
|
|
315
|
+
> table_exclude = ['internal_notes', 'created_at']
|
|
316
|
+
> ```
|
|
317
|
+
|
|
318
|
+
### Auto Subsections (Parent-Child Relations)
|
|
319
|
+
If a Section model has a `ManyToManyField` to another model that is **not** a standalone section (i.e. a "child" model), the system automatically nests it:
|
|
320
|
+
|
|
321
|
+
```python
|
|
322
|
+
class SubUnit(ScopedModel): # Child model (no is_section=True)
|
|
323
|
+
name = models.CharField(...)
|
|
324
|
+
|
|
325
|
+
class MainUnit(ScopedModel): # Parent section
|
|
326
|
+
is_section = True
|
|
327
|
+
sub_units = models.ManyToManyField(SubUnit)
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Result:**
|
|
331
|
+
- When editing a `MainUnit`, you will see a list of `SubUnits`.
|
|
332
|
+
- You can **Add/Edit/Delete** `SubUnits` directly from the `MainUnit` modal via AJAX.
|
|
333
|
+
- This creates a seamless "Master-Detail" management experience without writing a single view or form.
|
|
334
|
+
|
|
335
|
+
Notes:
|
|
336
|
+
- These attributes apply only to the auto-generated form/table.
|
|
337
|
+
- If you provide a custom Form/Table class, it takes full precedence.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Templates & Theming
|
|
342
|
+
|
|
343
|
+
### Base Template
|
|
344
|
+
The system provides a robust base template located at `microsys/templates/microsys/base.html`.
|
|
345
|
+
You can extend this template in your own views to maintain consistent layout and functionality:
|
|
346
|
+
|
|
347
|
+
```html
|
|
348
|
+
{% extends "microsys/base.html" %}
|
|
349
|
+
|
|
350
|
+
{% block extra_head %}
|
|
351
|
+
<!-- Extra CSS or Meta tags -->
|
|
352
|
+
{% endblock %}
|
|
353
|
+
|
|
354
|
+
{% block content %}
|
|
355
|
+
<h1>Page Content</h1>
|
|
356
|
+
{% endblock %}
|
|
357
|
+
|
|
358
|
+
{% block scripts %}
|
|
359
|
+
<!-- Extra JS scripts -->
|
|
360
|
+
{% endblock %}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
> **Note:** The base template automatically handles the sidebar, title bar, messages, and theme loading. Replacing it entirely will break core system functionality.
|
|
364
|
+
|
|
365
|
+
### Theming
|
|
366
|
+
- **Framework**: Built on **Bootstrap 5 (RTL)**.
|
|
367
|
+
- **Colors**: The `primary` color automatically adapts to the selected theme. Secondary/Success/Danger colors are slightly desaturated for better visual ergonomics.
|
|
368
|
+
- **Customization**:
|
|
369
|
+
- Use standard Bootstrap classes (`btn-primary`, `text-success`, etc.).
|
|
370
|
+
- Dark mode is supported out of the box. If you encounter issues, you can override styles via `extra_head` or report them.
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## File Structure
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
microsys/
|
|
378
|
+
├── management/ # Custom Management commands.
|
|
379
|
+
├── migrations/ # App Migrations.
|
|
380
|
+
├── static/ # microsys/ (js/css/img).
|
|
381
|
+
├── templates/ # microsys/ (flattened structure).
|
|
382
|
+
├── templatetags/ # Custom template tags.
|
|
383
|
+
├── tests/ # Development tests.
|
|
384
|
+
├── admin.py # Admin Panel Registration.
|
|
385
|
+
├── api.py # Autofill Api Configuration, Permission Checker, Serializer.
|
|
386
|
+
├── apps.py # Django App configuration.
|
|
387
|
+
├── context_processors.py # Branding, Scope, Sidebar order and Themes.
|
|
388
|
+
├── discovery.py # Sidebar auto-discovery logic.
|
|
389
|
+
├── fetcher.py # Universal Dynamic Downlolader.
|
|
390
|
+
├── filters.py # User and ActivityLog filters.
|
|
391
|
+
├── forms.py # User, Profile, Permissions, and Section forms
|
|
392
|
+
├── managers.py # ScopedModel Manager.
|
|
393
|
+
├── middleware.py # ActivityLog middleware.
|
|
394
|
+
├── models.py # Profile, Scope, Logs.
|
|
395
|
+
├── signals.py # Auto-create profile logic, Auto soft-delete logic, ActivityLog.
|
|
396
|
+
├── tables.py # User, ActivityLog, and Scope tables.
|
|
397
|
+
├── urls.py # URL routing.
|
|
398
|
+
├── utils.py # Helping Dynamic functions.
|
|
399
|
+
└── views.py # User and Scope management, Dynamic Zero-Boilerplate Section management.
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Version History
|
|
403
|
+
|
|
404
|
+
| Version | Changes |
|
|
405
|
+
|----------|---------|
|
|
406
|
+
| v1.0.0 | • Initial release as pip package |
|
|
407
|
+
| v1.1.0 | • URL restructure: auth at `/accounts/`, system at `/sys/` • Added `microsys_setup` and `microsys_check` management commands • Runtime configuration validation |
|
|
408
|
+
| v1.2.0 | • Name changed to `django-microsys` • Section model discovery hardened (dynamic app resolution, generic forms/tables/filters) • Scope fields now hide automatically when scopes are disabled • System sidebar group ships by default (configurable) • `is_staff` moved into the permissions UI |
|
|
409
|
+
| v1.3.0 | • Fixed subsection display: subsections now show correctly regardless of user scope • Fixed SessionInterrupted error: reduced session writes in section management • Scope toggle now accepts explicit target state to prevent race conditions • Improved error messaging in Arabic for scope operations |
|
|
410
|
+
| v1.4.0 | • Section table context menu: right-click on table rows for Edit/Delete actions • View Subsections modal: sections with M2M subsections show linked items • AJAX-based section deletion with related-record protection • Auto-generated tables now include row data attributes for JS binding |
|
|
411
|
+
| v1.5.0 | • Auto-generated section filters now include date range pickers (from/to) with flatpickr integration • Added clarifying inline comments to complex view logic • Fixed login Enter key submission • Pypi Release |
|
|
412
|
+
| v1.5.1 | • Fixed Readme file and added detailed instructions |
|
|
413
|
+
| v1.5.2 | • Optimized form and filters auto generation and layout |
|