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.
Files changed (130) hide show
  1. django_microsys-1.5.2/LICENSE +21 -0
  2. django_microsys-1.5.2/MANIFEST.in +19 -0
  3. django_microsys-1.5.2/PKG-INFO +413 -0
  4. django_microsys-1.5.2/README.md +381 -0
  5. django_microsys-1.5.2/django_microsys.egg-info/PKG-INFO +413 -0
  6. django_microsys-1.5.2/django_microsys.egg-info/SOURCES.txt +128 -0
  7. django_microsys-1.5.2/django_microsys.egg-info/dependency_links.txt +1 -0
  8. django_microsys-1.5.2/django_microsys.egg-info/requires.txt +6 -0
  9. django_microsys-1.5.2/django_microsys.egg-info/top_level.txt +1 -0
  10. django_microsys-1.5.2/microsys/__init__.py +0 -0
  11. django_microsys-1.5.2/microsys/admin.py +46 -0
  12. django_microsys-1.5.2/microsys/api.py +98 -0
  13. django_microsys-1.5.2/microsys/apps.py +90 -0
  14. django_microsys-1.5.2/microsys/context_processors.py +160 -0
  15. django_microsys-1.5.2/microsys/discovery.py +213 -0
  16. django_microsys-1.5.2/microsys/fetcher.py +288 -0
  17. django_microsys-1.5.2/microsys/filters.py +173 -0
  18. django_microsys-1.5.2/microsys/forms.py +654 -0
  19. django_microsys-1.5.2/microsys/management/commands/__init__.py +0 -0
  20. django_microsys-1.5.2/microsys/management/commands/microsys_check.py +172 -0
  21. django_microsys-1.5.2/microsys/management/commands/microsys_setup.py +53 -0
  22. django_microsys-1.5.2/microsys/managers.py +57 -0
  23. django_microsys-1.5.2/microsys/middleware.py +32 -0
  24. django_microsys-1.5.2/microsys/migrations/0001_initial.py +86 -0
  25. django_microsys-1.5.2/microsys/migrations/__init__.py +0 -0
  26. django_microsys-1.5.2/microsys/models.py +136 -0
  27. django_microsys-1.5.2/microsys/signals.py +178 -0
  28. django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap-icons.css +1390 -0
  29. django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap-icons.woff +0 -0
  30. django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap-icons.woff2 +0 -0
  31. django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap.bundle.min.js +7 -0
  32. django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap.bundle.min.js.map +1 -0
  33. django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap.rtl.min.css +6 -0
  34. django_microsys-1.5.2/microsys/static/bootstrap5/bootstrap.rtl.min.css.map +1 -0
  35. django_microsys-1.5.2/microsys/static/flatpickr/flatpickr.min.css +13 -0
  36. django_microsys-1.5.2/microsys/static/flatpickr/flatpickr.min.js +2 -0
  37. django_microsys-1.5.2/microsys/static/flatpickr/locale/ar.d.ts +72 -0
  38. django_microsys-1.5.2/microsys/static/flatpickr/locale/ar.js +62 -0
  39. django_microsys-1.5.2/microsys/static/img/base_logo.webp +0 -0
  40. django_microsys-1.5.2/microsys/static/img/default_profile.webp +0 -0
  41. django_microsys-1.5.2/microsys/static/img/login_logo.webp +0 -0
  42. django_microsys-1.5.2/microsys/static/main/css/accessibility.css +94 -0
  43. django_microsys-1.5.2/microsys/static/main/css/buttons.css +116 -0
  44. django_microsys-1.5.2/microsys/static/main/css/charts.css +44 -0
  45. django_microsys-1.5.2/microsys/static/main/css/doc_detail.css +101 -0
  46. django_microsys-1.5.2/microsys/static/main/css/dropdowns.css +53 -0
  47. django_microsys-1.5.2/microsys/static/main/css/gen_pdf.css +126 -0
  48. django_microsys-1.5.2/microsys/static/main/css/gen_report.css +74 -0
  49. django_microsys-1.5.2/microsys/static/main/css/index_cards.css +164 -0
  50. django_microsys-1.5.2/microsys/static/main/css/main.css +294 -0
  51. django_microsys-1.5.2/microsys/static/main/css/navtabs.css +49 -0
  52. django_microsys-1.5.2/microsys/static/main/css/pagination.css +35 -0
  53. django_microsys-1.5.2/microsys/static/main/css/tables.css +119 -0
  54. django_microsys-1.5.2/microsys/static/main/css/titlebar.css +58 -0
  55. django_microsys-1.5.2/microsys/static/main/fonts/Amiri-Bold.woff2 +0 -0
  56. django_microsys-1.5.2/microsys/static/main/fonts/Amiri-BoldItalic.woff2 +0 -0
  57. django_microsys-1.5.2/microsys/static/main/fonts/Amiri-Italic.woff2 +0 -0
  58. django_microsys-1.5.2/microsys/static/main/fonts/Amiri-Regular.woff2 +0 -0
  59. django_microsys-1.5.2/microsys/static/main/fonts/Shabwa-Bold.woff2 +0 -0
  60. django_microsys-1.5.2/microsys/static/main/fonts/Shabwa-Medium.woff2 +0 -0
  61. django_microsys-1.5.2/microsys/static/main/fonts/Shabwa.woff2 +0 -0
  62. django_microsys-1.5.2/microsys/static/main/js/accessibility.js +79 -0
  63. django_microsys-1.5.2/microsys/static/main/js/anime.min.js +8 -0
  64. django_microsys-1.5.2/microsys/static/main/js/autofill.js +184 -0
  65. django_microsys-1.5.2/microsys/static/main/js/plotly-basic.min.js +47 -0
  66. django_microsys-1.5.2/microsys/static/main/js/plotly-locale-ar.js +1 -0
  67. django_microsys-1.5.2/microsys/static/main/js/scan_button.js +109 -0
  68. django_microsys-1.5.2/microsys/static/main/js/scanlink.js +343 -0
  69. django_microsys-1.5.2/microsys/static/sections/css/context_menu.css +80 -0
  70. django_microsys-1.5.2/microsys/static/sections/js/context_menu.js +687 -0
  71. django_microsys-1.5.2/microsys/static/sidebar/css/reorder.css +91 -0
  72. django_microsys-1.5.2/microsys/static/sidebar/css/theme_picker.css +165 -0
  73. django_microsys-1.5.2/microsys/static/sidebar/js/reorder.js +267 -0
  74. django_microsys-1.5.2/microsys/static/sidebar/js/theme_picker.js +58 -0
  75. django_microsys-1.5.2/microsys/static/sidebar/sidebar.css +232 -0
  76. django_microsys-1.5.2/microsys/static/sidebar/sidebar.js +140 -0
  77. django_microsys-1.5.2/microsys/static/themes/blue.css +52 -0
  78. django_microsys-1.5.2/microsys/static/themes/dark.css +552 -0
  79. django_microsys-1.5.2/microsys/static/themes/gold.css +52 -0
  80. django_microsys-1.5.2/microsys/static/themes/green.css +64 -0
  81. django_microsys-1.5.2/microsys/static/themes/light.css +52 -0
  82. django_microsys-1.5.2/microsys/static/themes/main.css +6 -0
  83. django_microsys-1.5.2/microsys/static/themes/main.js +41 -0
  84. django_microsys-1.5.2/microsys/static/themes/red.css +52 -0
  85. django_microsys-1.5.2/microsys/static/tutorial/driver.js +2 -0
  86. django_microsys-1.5.2/microsys/static/tutorial/tutorial.css +147 -0
  87. django_microsys-1.5.2/microsys/static/tutorial/tutorial.js +297 -0
  88. django_microsys-1.5.2/microsys/static/users/css/login.css +273 -0
  89. django_microsys-1.5.2/microsys/static/users/css/permissions.css +105 -0
  90. django_microsys-1.5.2/microsys/static/users/css/profile.css +123 -0
  91. django_microsys-1.5.2/microsys/static/users/js/login.js +15 -0
  92. django_microsys-1.5.2/microsys/static/users/js/manage_users.js +191 -0
  93. django_microsys-1.5.2/microsys/static/users/js/permissions.js +94 -0
  94. django_microsys-1.5.2/microsys/static/users/js/user_activity_log.js +9 -0
  95. django_microsys-1.5.2/microsys/tables.py +75 -0
  96. django_microsys-1.5.2/microsys/templates/includes/autofill_toggle.html +32 -0
  97. django_microsys-1.5.2/microsys/templates/includes/scan.html +3 -0
  98. django_microsys-1.5.2/microsys/templates/includes/sidebar_items.html +7 -0
  99. django_microsys-1.5.2/microsys/templates/includes/titlebar.html +64 -0
  100. django_microsys-1.5.2/microsys/templates/includes/tutorial.html +6 -0
  101. django_microsys-1.5.2/microsys/templates/microsys/base.html +117 -0
  102. django_microsys-1.5.2/microsys/templates/microsys/dashboard.html +83 -0
  103. django_microsys-1.5.2/microsys/templates/microsys/options.html +250 -0
  104. django_microsys-1.5.2/microsys/templates/microsys/profile/profile.html +114 -0
  105. django_microsys-1.5.2/microsys/templates/microsys/profile/profile_edit.html +100 -0
  106. django_microsys-1.5.2/microsys/templates/microsys/scopes/scope_actions.html +9 -0
  107. django_microsys-1.5.2/microsys/templates/microsys/scopes/scope_form.html +19 -0
  108. django_microsys-1.5.2/microsys/templates/microsys/scopes/scope_manager.html +12 -0
  109. django_microsys-1.5.2/microsys/templates/microsys/sections/manage_sections.html +224 -0
  110. django_microsys-1.5.2/microsys/templates/microsys/sections/subsection_select.html +95 -0
  111. django_microsys-1.5.2/microsys/templates/microsys/user_activity_log.html +31 -0
  112. django_microsys-1.5.2/microsys/templates/microsys/users/grouped_permissions.html +79 -0
  113. django_microsys-1.5.2/microsys/templates/microsys/users/manage_users.html +132 -0
  114. django_microsys-1.5.2/microsys/templates/microsys/users/user_actions.html +34 -0
  115. django_microsys-1.5.2/microsys/templates/microsys/users/user_detail.html +108 -0
  116. django_microsys-1.5.2/microsys/templates/microsys/users/user_form.html +37 -0
  117. django_microsys-1.5.2/microsys/templates/registration/login.html +62 -0
  118. django_microsys-1.5.2/microsys/templates/sidebar/auto.html +15 -0
  119. django_microsys-1.5.2/microsys/templates/sidebar/extra_groups.html +34 -0
  120. django_microsys-1.5.2/microsys/templates/sidebar/main.html +133 -0
  121. django_microsys-1.5.2/microsys/templatetags/__init__.py +1 -0
  122. django_microsys-1.5.2/microsys/templatetags/sidebar_tags.py +74 -0
  123. django_microsys-1.5.2/microsys/tests/__init__.py +0 -0
  124. django_microsys-1.5.2/microsys/tests/test_utils_discovery.py +24 -0
  125. django_microsys-1.5.2/microsys/urls.py +52 -0
  126. django_microsys-1.5.2/microsys/utils.py +661 -0
  127. django_microsys-1.5.2/microsys/views.py +1289 -0
  128. django_microsys-1.5.2/pyproject.toml +56 -0
  129. django_microsys-1.5.2/setup.cfg +4 -0
  130. 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
+ [![PyPI version](https://badge.fury.io/py/django-microsys.svg)](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 |