Skip to content
Snippets Groups Projects
Commit 168d8000 authored by HeJ's avatar HeJ
Browse files

Merge branch 'feat/admin-docs' into 'develop'

Add Django admindocs

See merge request !1001
parents 8aed9e29 47b4214c
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
groups = ["default", "dev", "lint", "local"] groups = ["default", "dev", "lint", "local"]
strategy = ["inherit_metadata"] strategy = ["inherit_metadata"]
lock_version = "4.5.0" lock_version = "4.5.0"
content_hash = "sha256:ff4b6100ab5701fd2db52fc09ab9dd6fe1204796bef99587a8b440570d0eb515" content_hash = "sha256:a7320608dc0e3c00f197dee7ada9261e62bd35dd235e56b9532d22126d225946"
[[metadata.targets]] [[metadata.targets]]
requires_python = "==3.13.*" requires_python = "==3.13.*"
...@@ -596,6 +596,17 @@ files = [ ...@@ -596,6 +596,17 @@ files = [
{file = "djlint-1.35.2.tar.gz", hash = "sha256:318de9d4b9b0061a111f8f5164ecbacd8215f449dd4bd5a76d2a691c815ee103"}, {file = "djlint-1.35.2.tar.gz", hash = "sha256:318de9d4b9b0061a111f8f5164ecbacd8215f449dd4bd5a76d2a691c815ee103"},
] ]
[[package]]
name = "docutils"
version = "0.21.2"
requires_python = ">=3.9"
summary = "Docutils -- Python Documentation Utilities"
groups = ["dev"]
files = [
{file = "docutils-0.21.2-py3-none-any.whl", hash = "sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2"},
{file = "docutils-0.21.2.tar.gz", hash = "sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f"},
]
[[package]] [[package]]
name = "editorconfig" name = "editorconfig"
version = "0.12.4" version = "0.12.4"
......
...@@ -68,6 +68,7 @@ dev = [ ...@@ -68,6 +68,7 @@ dev = [
"coverage>=7.4.0", "coverage>=7.4.0",
"tox-pdm>=0.7.2", "tox-pdm>=0.7.2",
"pre-commit>=3.6.0", "pre-commit>=3.6.0",
"docutils>=0.21.2",
] ]
[tool.pdm.scripts] [tool.pdm.scripts]
......
...@@ -39,6 +39,7 @@ django-timezone-field==7.0 ...@@ -39,6 +39,7 @@ django-timezone-field==7.0
django-widget-tweaks==1.5.0 django-widget-tweaks==1.5.0
djangorestframework==3.15.2 djangorestframework==3.15.2
djlint==1.35.2 djlint==1.35.2
docutils==0.21.2
editorconfig==0.12.4 editorconfig==0.12.4
et-xmlfile==1.1.0 et-xmlfile==1.1.0
executing==2.1.0 executing==2.1.0
......
...@@ -82,6 +82,9 @@ if DEBUG and SECRET_KEY is None: # noqa: F405 ...@@ -82,6 +82,9 @@ if DEBUG and SECRET_KEY is None: # noqa: F405
except OSError: except OSError:
raise Exception(f'Please create a {SECRET_FILE} file with random characters to serve as your Django SECRET_KEY!') raise Exception(f'Please create a {SECRET_FILE} file with random characters to serve as your Django SECRET_KEY!')
if DEBUG: # noqa: F405
INSTALLED_APPS.insert(INSTALLED_APPS.index('django.contrib.staticfiles') + 1, ('django.contrib.admindocs')) # noqa: F405
# include API django api # include API django api
if IS_API: if IS_API:
# add 'api' app and ensure 'core' and it are before 'oauth2_provider' and 'rest_framework' for proper template loading # add 'api' app and ensure 'core' and it are before 'oauth2_provider' and 'rest_framework' for proper template loading
......
...@@ -63,6 +63,9 @@ if not any(services.values()): ...@@ -63,6 +63,9 @@ if not any(services.values()):
# Any service that is not the last one is served with a prefix. # Any service that is not the last one is served with a prefix.
# The last service is served at root. # The last service is served at root.
# Priority: Frontend -> Backoffice -> API -> Admin # Priority: Frontend -> Backoffice -> API -> Admin
if 'django.contrib.staticfiles' in settings.INSTALLED_APPS:
# Add the Admin Docs package to show current Documentation generated from docstrings
urlpatterns += add_service('admin', 'c3admin/docs/', include('django.contrib.admindocs.urls'))
urlpatterns += add_service('admin', 'c3admin/', admin.site.urls) urlpatterns += add_service('admin', 'c3admin/', admin.site.urls)
urlpatterns += (path('i18n/setlang/', views.set_language, name='set_language'),) urlpatterns += (path('i18n/setlang/', views.set_language, name='set_language'),)
services.pop('admin') services.pop('admin')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment