django-adminflow 1.0.0__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 (52) hide show
  1. django_adminflow-1.0.0/PKG-INFO +398 -0
  2. django_adminflow-1.0.0/README.md +353 -0
  3. django_adminflow-1.0.0/adminflow/__init__.py +1 -0
  4. django_adminflow-1.0.0/adminflow/apps.py +22 -0
  5. django_adminflow-1.0.0/adminflow/context_processors.py +72 -0
  6. django_adminflow-1.0.0/adminflow/forms.py +89 -0
  7. django_adminflow-1.0.0/adminflow/import_export.py +224 -0
  8. django_adminflow-1.0.0/adminflow/static/adminflow/img/logo.png +0 -0
  9. django_adminflow-1.0.0/adminflow/templates/admin/actions.html +79 -0
  10. django_adminflow-1.0.0/adminflow/templates/admin/base.html +1263 -0
  11. django_adminflow-1.0.0/adminflow/templates/admin/base_site.html +5 -0
  12. django_adminflow-1.0.0/adminflow/templates/admin/change_form.html +315 -0
  13. django_adminflow-1.0.0/adminflow/templates/admin/change_list.html +216 -0
  14. django_adminflow-1.0.0/adminflow/templates/admin/change_list_results.html +211 -0
  15. django_adminflow-1.0.0/adminflow/templates/admin/delete_confirmation.html +55 -0
  16. django_adminflow-1.0.0/adminflow/templates/admin/delete_selected_confirmation.html +118 -0
  17. django_adminflow-1.0.0/adminflow/templates/admin/edit_inline/stacked.html +85 -0
  18. django_adminflow-1.0.0/adminflow/templates/admin/edit_inline/tabular.html +81 -0
  19. django_adminflow-1.0.0/adminflow/templates/admin/filter.html +17 -0
  20. django_adminflow-1.0.0/adminflow/templates/admin/import_export/change_list_export_item.html +8 -0
  21. django_adminflow-1.0.0/adminflow/templates/admin/import_export/change_list_import_item.html +8 -0
  22. django_adminflow-1.0.0/adminflow/templates/admin/import_export/export.html +199 -0
  23. django_adminflow-1.0.0/adminflow/templates/admin/includes/fieldset.html +73 -0
  24. django_adminflow-1.0.0/adminflow/templates/admin/includes/toast.html +102 -0
  25. django_adminflow-1.0.0/adminflow/templates/admin/index.html +227 -0
  26. django_adminflow-1.0.0/adminflow/templates/admin/logged_out.html +38 -0
  27. django_adminflow-1.0.0/adminflow/templates/admin/login.html +144 -0
  28. django_adminflow-1.0.0/adminflow/templates/admin/object_history.html +60 -0
  29. django_adminflow-1.0.0/adminflow/templates/admin/pagination.html +30 -0
  30. django_adminflow-1.0.0/adminflow/templates/admin/search_form.html +28 -0
  31. django_adminflow-1.0.0/adminflow/templates/admin/submit_line.html +48 -0
  32. django_adminflow-1.0.0/adminflow/templates/admin/verify_2fa.html +280 -0
  33. django_adminflow-1.0.0/adminflow/templates/otp/email/token.html +64 -0
  34. django_adminflow-1.0.0/adminflow/templates/otp/email/token.txt +11 -0
  35. django_adminflow-1.0.0/adminflow/templates/registration/logged_out.html +38 -0
  36. django_adminflow-1.0.0/adminflow/templates/registration/password_change_form.html +272 -0
  37. django_adminflow-1.0.0/adminflow/templates/simple_history/object_history.html +186 -0
  38. django_adminflow-1.0.0/adminflow/templates/simple_history/object_history_form.html +103 -0
  39. django_adminflow-1.0.0/adminflow/templates/simple_history/submit_line.html +17 -0
  40. django_adminflow-1.0.0/adminflow/templatetags/__init__.py +1 -0
  41. django_adminflow-1.0.0/adminflow/templatetags/__pycache__/__init__.cpython-314.pyc +0 -0
  42. django_adminflow-1.0.0/adminflow/templatetags/__pycache__/adminflow_tags.cpython-314.pyc +0 -0
  43. django_adminflow-1.0.0/adminflow/templatetags/adminflow_tags.py +233 -0
  44. django_adminflow-1.0.0/adminflow/user_admin.py +662 -0
  45. django_adminflow-1.0.0/adminflow/views.py +207 -0
  46. django_adminflow-1.0.0/django_adminflow.egg-info/PKG-INFO +398 -0
  47. django_adminflow-1.0.0/django_adminflow.egg-info/SOURCES.txt +50 -0
  48. django_adminflow-1.0.0/django_adminflow.egg-info/dependency_links.txt +1 -0
  49. django_adminflow-1.0.0/django_adminflow.egg-info/requires.txt +19 -0
  50. django_adminflow-1.0.0/django_adminflow.egg-info/top_level.txt +1 -0
  51. django_adminflow-1.0.0/pyproject.toml +85 -0
  52. django_adminflow-1.0.0/setup.cfg +4 -0
@@ -0,0 +1,398 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-adminflow
3
+ Version: 1.0.0
4
+ Summary: A premium, modern SaaS design system for the Django Admin interface with built-in 2FA, history tracking, and import/export
5
+ Author-email: Edgar <edgar@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://pypi.org/project/django-adminflow/
8
+ Project-URL: Documentation, https://github.com/edgar/django-adminflow#readme
9
+ Project-URL: Repository, https://github.com/edgar/django-adminflow
10
+ Project-URL: Bug Tracker, https://github.com/edgar/django-adminflow/issues
11
+ Project-URL: Changelog, https://github.com/edgar/django-adminflow/blob/main/CHANGELOG.md
12
+ Keywords: django,admin,saas,design-system,2fa,otp,history,import,export,adminflow
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Environment :: Web Environment
15
+ Classifier: Framework :: Django
16
+ Classifier: Framework :: Django :: 4.2
17
+ Classifier: Framework :: Django :: 5.0
18
+ Classifier: Framework :: Django :: 5.1
19
+ Classifier: Intended Audience :: Developers
20
+ Classifier: License :: OSI Approved :: MIT License
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Topic :: Internet :: WWW/HTTP
27
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
28
+ Requires-Python: >=3.10
29
+ Description-Content-Type: text/markdown
30
+ Requires-Dist: Django>=4.2
31
+ Provides-Extra: otp
32
+ Requires-Dist: django-otp>=1.4; extra == "otp"
33
+ Provides-Extra: history
34
+ Requires-Dist: django-simple-history>=3.4; extra == "history"
35
+ Provides-Extra: import-export
36
+ Requires-Dist: django-import-export>=4.0; extra == "import-export"
37
+ Requires-Dist: tablib[xlsx]>=3.5; extra == "import-export"
38
+ Requires-Dist: openpyxl>=3.1; extra == "import-export"
39
+ Provides-Extra: all
40
+ Requires-Dist: django-otp>=1.4; extra == "all"
41
+ Requires-Dist: django-simple-history>=3.4; extra == "all"
42
+ Requires-Dist: django-import-export>=4.0; extra == "all"
43
+ Requires-Dist: tablib[xlsx]>=3.5; extra == "all"
44
+ Requires-Dist: openpyxl>=3.1; extra == "all"
45
+
46
+ # django-adminflow
47
+
48
+ **A modern Django Admin UI template with built-in integrations for popular 3rd party packages.**
49
+
50
+ [![PyPI version](https://img.shields.io/pypi/v/django-adminflow.svg)](https://pypi.org/project/django-adminflow/)
51
+ [![Python versions](https://img.shields.io/pypi/pyversions/django-adminflow.svg)](https://pypi.org/project/django-adminflow/)
52
+ [![Django versions](https://img.shields.io/pypi/djversions/django-adminflow.svg)](https://pypi.org/project/django-adminflow/)
53
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
54
+ [![Docs](https://readthedocs.org/projects/django-adminflow/badge/?version=latest)](https://django-adminflow.readthedocs.io/)
55
+
56
+ AdminFlow is a **drop-in Django Admin UI template** that replaces the default Django admin with a clean, minimalist SaaS-grade interface. Beyond the UI refresh, it ships with **ready-to-use integrations** for the most popular Django ecosystem packages — two-factor authentication, per-record audit history, and multi-format import/export — so you get powerful admin features with zero boilerplate.
57
+
58
+ > **One package. Install it, add it to `INSTALLED_APPS`, and your admin instantly looks and works like a premium SaaS product.**
59
+
60
+ ---
61
+
62
+ ## What is AdminFlow?
63
+
64
+ The default Django admin is functional but dated. AdminFlow wraps it with:
65
+
66
+ - A **modern, minimalist UI** built with Tailwind utility classes and Material Symbols icons
67
+ - A **collapsible sidebar** with app grouping, icons per model, and active state tracking
68
+ - **Responsive layouts** — works on tablet and desktop
69
+ - **Clean typography** using Inter font (loaded from Google Fonts)
70
+ - **Integrated 3rd party packages** — install the extras you need, and the UI for them is already there
71
+
72
+ AdminFlow is **not** a full CMS replacement. It is a **UI skin + integration layer** for the Django admin you already use.
73
+
74
+ ---
75
+
76
+ ## Screenshots
77
+
78
+ | Login | Dashboard |
79
+ |---|---|
80
+ | ![Login](docs/_static/screenshots/login.png) | ![Dashboard](docs/_static/screenshots/dashboard.png) |
81
+
82
+ | Customer List | Change Form |
83
+ |---|---|
84
+ | ![Changelist](docs/_static/screenshots/changelist.png) | ![Change form](docs/_static/screenshots/change_form.png) |
85
+
86
+ | Export Page | Audit History |
87
+ |---|---|
88
+ | ![Export](docs/_static/screenshots/export.png) | ![History](docs/_static/screenshots/history.png) |
89
+
90
+ | Import Page | 2FA / User Security |
91
+ |---|---|
92
+ | ![Import](docs/_static/screenshots/import_page.png) | ![2FA](docs/_static/screenshots/user_2fa.png) |
93
+
94
+ ---
95
+
96
+ ## Features
97
+
98
+ | Feature | Description |
99
+ |---|---|
100
+ | 🎨 **Modern UI** | Minimalist SaaS design — sidebar navigation, clean typography, responsive layout |
101
+ | 🔒 **Two-Factor Auth** | TOTP (Google/Authy), email OTP, backup codes — multi-device support |
102
+ | 📜 **Audit History** | Per-record change history with field-level diffs |
103
+ | 📤 **Import / Export** | Multi-sheet XLSX + nested JSON with related models in one file |
104
+ | 🔌 **Plug & Play** | Add to `INSTALLED_APPS` — no extra config required for core UI |
105
+ | 🌐 **i18n Ready** | All UI strings use `{% translate %}` |
106
+
107
+ ---
108
+
109
+ ## Installation
110
+
111
+ ```bash
112
+ # Core UI only
113
+ pip install django-adminflow
114
+
115
+ # With 2FA (django-otp)
116
+ pip install "django-adminflow[otp]"
117
+
118
+ # With audit history (django-simple-history)
119
+ pip install "django-adminflow[history]"
120
+
121
+ # With import / export (django-import-export)
122
+ pip install "django-adminflow[import-export]"
123
+
124
+ # Everything
125
+ pip install "django-adminflow[all]"
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Setup — `settings.py`
131
+
132
+ ### `INSTALLED_APPS`
133
+
134
+ > ⚠️ `"adminflow"` must come **before** `"django.contrib.admin"`
135
+
136
+ ```python
137
+ INSTALLED_APPS = [
138
+ "adminflow", # ← FIRST, before django.contrib.admin
139
+ "django.contrib.admin",
140
+ "django.contrib.auth",
141
+ "django.contrib.contenttypes",
142
+ "django.contrib.sessions",
143
+ "django.contrib.messages",
144
+ "django.contrib.staticfiles",
145
+
146
+ # Add only what you installed:
147
+ "simple_history", # audit history
148
+ "import_export", # import / export
149
+ "django_otp", # 2FA core
150
+ "django_otp.plugins.otp_totp", # TOTP (Google Authenticator, Authy)
151
+ "django_otp.plugins.otp_email", # email one-time passwords
152
+ "django_otp.plugins.otp_static", # backup / recovery codes
153
+ ]
154
+ ```
155
+
156
+ ### `MIDDLEWARE`
157
+
158
+ ```python
159
+ MIDDLEWARE = [
160
+ "django.middleware.security.SecurityMiddleware",
161
+ "django.contrib.sessions.middleware.SessionMiddleware",
162
+ "django.middleware.common.CommonMiddleware",
163
+ "django.middleware.csrf.CsrfViewMiddleware",
164
+ "django.contrib.auth.middleware.AuthenticationMiddleware",
165
+ "django_otp.middleware.OTPMiddleware", # ← 2FA (after Auth)
166
+ "django.contrib.messages.middleware.MessageMiddleware",
167
+ "django.middleware.clickjacking.XFrameOptionsMiddleware",
168
+ "simple_history.middleware.HistoryRequestMiddleware", # ← history
169
+ ]
170
+ ```
171
+
172
+ ### `TEMPLATES` — context processor (required)
173
+
174
+ > ⚠️ Without `adminflow.context_processors.adminflow_settings`, the sidebar title, colours and login panel will not render.
175
+
176
+ ```python
177
+ TEMPLATES = [
178
+ {
179
+ "BACKEND": "django.template.backends.django.DjangoTemplates",
180
+ "DIRS": [],
181
+ "APP_DIRS": True,
182
+ "OPTIONS": {
183
+ "context_processors": [
184
+ "django.template.context_processors.request",
185
+ "django.contrib.auth.context_processors.auth",
186
+ "django.contrib.messages.context_processors.messages",
187
+ "adminflow.context_processors.adminflow_settings", # ← required
188
+ ],
189
+ },
190
+ },
191
+ ]
192
+ ```
193
+
194
+ ### AdminFlow Settings
195
+
196
+ ```python
197
+ # ── Branding ──────────────────────────────────────────────────────────────────
198
+ ADMINFLOW_TITLE = "My App" # sidebar header + browser tab title
199
+ ADMINFLOW_COMPANY = "My Company" # admin footer text
200
+ # ADMINFLOW_LOGO = "logo.svg" # path relative to MEDIA_URL (optional)
201
+
202
+ # ── Login page hero ───────────────────────────────────────────────────────────
203
+ ADMINFLOW_LOGIN_TITLE = "Welcome back"
204
+ ADMINFLOW_LOGIN_SUBTITLE = "Sign in to manage your application."
205
+
206
+ # ── Theme colours ─────────────────────────────────────────────────────────────
207
+ ADMINFLOW_PRIMARY_COLOR = "#1f2021"
208
+ ADMINFLOW_SECONDARY_COLOR = "#475569"
209
+ ADMINFLOW_SUCCESS_COLOR = "#10B981"
210
+ ADMINFLOW_WARNING_COLOR = "#F59E0B"
211
+ ADMINFLOW_DANGER_COLOR = "#EF4444"
212
+
213
+ # ── Sidebar ───────────────────────────────────────────────────────────────────
214
+ ADMINFLOW_SIDEBAR_COLOR = "#0f172a" # background
215
+ ADMINFLOW_SIDEBAR_TEXT_COLOR = "#94a3b8" # inactive item text
216
+ ADMINFLOW_SIDEBAR_ACTIVE_TEXT_COLOR = "#ffffff" # active item text
217
+ ADMINFLOW_SIDEBAR_COLLAPSIBLE = True
218
+ ADMINFLOW_SIDEBAR_WIDTH = 280 # pixels
219
+
220
+ # ── UI ────────────────────────────────────────────────────────────────────────
221
+ ADMINFLOW_BORDER_RADIUS = "16px"
222
+ ADMINFLOW_FONT = "Inter" # any Google Font name
223
+ ADMINFLOW_ENABLE_COMMAND_PALETTE = True # Cmd+K quick search
224
+
225
+ # ── 2FA ───────────────────────────────────────────────────────────────────────
226
+ ADMINFLOW_DJANGO_OTP = True # show OTP verification screen after login
227
+ ```
228
+
229
+ ### Email (for Email OTP)
230
+
231
+ ```python
232
+ EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
233
+ EMAIL_HOST = "smtp.gmail.com"
234
+ EMAIL_PORT = 587
235
+ EMAIL_USE_TLS = True
236
+ EMAIL_HOST_USER = "noreply@myapp.com"
237
+ EMAIL_HOST_PASSWORD = "your-smtp-password" # use .env, never commit
238
+ DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
239
+
240
+ OTP_EMAIL_SENDER = EMAIL_HOST_USER
241
+ OTP_EMAIL_FROM_EMAIL = EMAIL_HOST_USER
242
+ OTP_EMAIL_COOLDOWN_DURATION = 60 # seconds between OTP requests
243
+ ```
244
+
245
+ ---
246
+
247
+ ## 3rd Party Integrations
248
+
249
+ ### 🔒 Two-Factor Authentication — `django-otp`
250
+
251
+ ```python
252
+ # admin.py
253
+ from django.contrib import admin
254
+ from django.contrib.auth import get_user_model
255
+ from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
256
+ from adminflow.user_admin import AdminFlowUserAdminMixin, get_2fa_inlines, unregister_otp_models
257
+
258
+ User = get_user_model()
259
+
260
+ @admin.register(User)
261
+ class UserAdmin(AdminFlowUserAdminMixin, BaseUserAdmin):
262
+ inlines = get_2fa_inlines()
263
+
264
+ unregister_otp_models() # removes raw django-otp admin entries
265
+ ```
266
+
267
+ **What you get:** TOTP + email OTP + backup codes, multi-device per user, admin bulk actions (*Enable 2FA*, *Generate backup codes*).
268
+
269
+ ---
270
+
271
+ ### 📜 Audit History — `django-simple-history`
272
+
273
+ ```python
274
+ # models.py
275
+ from simple_history.models import HistoricalRecords
276
+
277
+ class Customer(models.Model):
278
+ name = models.CharField(max_length=200)
279
+ email = models.EmailField(unique=True)
280
+ history = HistoricalRecords() # ← add this
281
+
282
+ # admin.py
283
+ from simple_history.admin import SimpleHistoryAdmin
284
+
285
+ @admin.register(Customer)
286
+ class CustomerAdmin(SimpleHistoryAdmin):
287
+ list_display = ('name', 'email')
288
+ ```
289
+
290
+ ---
291
+
292
+ ### 📤 Import / Export — `django-import-export`
293
+
294
+ Add `import_export` to `INSTALLED_APPS`, then use `MultiSheetExportImportMixin`:
295
+
296
+ ```python
297
+ # resources.py
298
+ from import_export import resources, fields
299
+ from import_export.widgets import ForeignKeyWidget
300
+ from .models import Customer, Order
301
+
302
+ class CustomerResource(resources.ModelResource):
303
+ class Meta:
304
+ model = Customer
305
+ fields = ('id', 'name', 'email', 'phone', 'notes', 'date_created')
306
+
307
+ class OrderResource(resources.ModelResource):
308
+ customer = fields.Field(
309
+ column_name='customer_email',
310
+ attribute='customer',
311
+ widget=ForeignKeyWidget(Customer, field='email'),
312
+ )
313
+ class Meta:
314
+ model = Order
315
+ fields = ('id', 'customer', 'product', 'order_date', 'status', 'total_amount')
316
+
317
+ # admin.py
318
+ from adminflow.import_export import MultiSheetExportImportMixin
319
+ from import_export.admin import ImportExportModelAdmin
320
+
321
+ @admin.register(Customer)
322
+ class CustomerAdmin(MultiSheetExportImportMixin, ImportExportModelAdmin, admin.ModelAdmin):
323
+ combined_sheets = [
324
+ ('General Details', CustomerResource, None),
325
+ ('Orders', OrderResource, lambda qs: Order.objects.filter(customer__in=qs)),
326
+ ]
327
+ ```
328
+
329
+ **Export formats:**
330
+
331
+ | Format | Output |
332
+ |---|---|
333
+ | **xlsx** | One `.xlsx` file — one sheet per resource |
334
+ | **json** | One `.json` file — children nested inside each parent record |
335
+
336
+ **JSON output example:**
337
+
338
+ ```json
339
+ [
340
+ {
341
+ "id": "1",
342
+ "name": "Alice Johnson",
343
+ "email": "alice@example.com",
344
+ "orders": [
345
+ { "id": "1", "customer_email": "alice@example.com", "order_date": "2026-07-22", "status": "delivered" }
346
+ ]
347
+ }
348
+ ]
349
+ ```
350
+
351
+ ---
352
+
353
+ ## Customisation
354
+
355
+ ```python
356
+ # admin.py — Material Symbols icon per model
357
+ @admin.register(Product)
358
+ class ProductAdmin(admin.ModelAdmin):
359
+ icon = "inventory_2" # browse at fonts.google.com/icons
360
+
361
+ # apps.py — sidebar group label
362
+ class CrmConfig(AppConfig):
363
+ name = "crm"
364
+ verbose_name = "Customer Relations (CRM)"
365
+ ```
366
+
367
+ ---
368
+
369
+ ## Changelog
370
+
371
+ ### v1.0.0 — 2026-07-23
372
+ - Initial stable release
373
+ - Modern minimalist admin UI (sidebar, Inter font, responsive)
374
+ - Full 2FA: TOTP, email OTP, backup codes, multi-device
375
+ - Audit history with field-level diffs (django-simple-history)
376
+ - Multi-sheet XLSX export/import (one sheet per related model)
377
+ - Nested JSON export (children embedded inside parent records)
378
+ - `MultiSheetExportImportMixin` for plug-and-play multi-resource export
379
+ - Styled Import / Export buttons, export page with field chips, import page
380
+ - All `ADMINFLOW_*` theme settings
381
+
382
+ ---
383
+
384
+ ## Publishing to PyPI
385
+
386
+ ```bash
387
+ pip install build twine
388
+ python -m build
389
+ twine upload dist/*
390
+ ```
391
+
392
+ ## Documentation
393
+
394
+ Full documentation: [django-adminflow.readthedocs.io](https://django-adminflow.readthedocs.io/)
395
+
396
+ ## License
397
+
398
+ MIT