Edit contents directly on your page with Django
Project description
DjSuperAdmin
✍🏻 Edit contents directly on your page with Django
Watch the video to see how it works
Installation
pip install djsuperadmin
Setup
Add djsuperadmin
to your INSTALLED_APPS
in settings.py
INSTALLED_APPS = [
# ...
'djsuperadmin'
]
And import all the required js files in the footer
{% load djsuperadmintag %}
{% djsuperadminjs %}
Usage
Define your custom Content
model using DjSuperAdminMixin
and provide an endpoint to GET/PATCH your content
from django.db import models
from djsuperadmin.mixins import DjSuperAdminMixin
class GenericContent(models.Model, DjSuperAdminMixin):
identifier = models.CharField(max_length=200, unique=True)
content = models.TextField()
@property
def superadmin_get_url(self):
return f'/api/content/{self.pk}'
@property
def superadmin_patch_url(self):
return f'/api/content/{self.pk}'
Then in your template
{% load djsuperadmintag %}
...
<body>
<p>
{% superadmin_content your_object 'your_object_attribute' %}
</p>
</body>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
djsuperadmin-0.9.1.tar.gz
(15.1 kB
view details)
Built Distribution
File details
Details for the file djsuperadmin-0.9.1.tar.gz
.
File metadata
- Download URL: djsuperadmin-0.9.1.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ddf2430e6b59c265157fb1717a18a6b0a87394ea64618a175d0ec15f5a0d99f |
|
MD5 | a15663e883c6e9e6ee8ef6cb926d7559 |
|
BLAKE2b-256 | ad98061894bb7442daa8111ee1440de4659a83e9eedba963abb2eb3e2366ac70 |
File details
Details for the file djsuperadmin-0.9.1-py2.py3-none-any.whl
.
File metadata
- Download URL: djsuperadmin-0.9.1-py2.py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28a8891813d4275a4e3ea6bdd50c9e878be6c5da0fec05a6154f5cfd26fbb0db |
|
MD5 | 3b4a87af3c36b9f74e8308af860f3b72 |
|
BLAKE2b-256 | 63af9f5fa280896648321893499ae9e5a909918b819bd4bcf4eeebf7f2d42c84 |