Edit contents directly on your page with Django
Project description
DjSuperAdmin
✍🏻 Edit contents directly on your page with Django
Here 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.11.0.tar.gz
(9.8 kB
view details)
Built Distribution
File details
Details for the file djsuperadmin-0.11.0.tar.gz
.
File metadata
- Download URL: djsuperadmin-0.11.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/37.2 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.12.0 keyring/23.9.3 rfc3986/2.0.0 colorama/0.4.5 CPython/3.9.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7728af4311a010620f53044129146d7104834cba66b2f4b6580aa8799fe87c03 |
|
MD5 | c38aa436945a2ef557688561c03ae562 |
|
BLAKE2b-256 | d4abb7f52ad5ce62d2d77549cd500cabd1d303c98c64fbd7a9ef5773d917128e |
File details
Details for the file djsuperadmin-0.11.0-py2.py3-none-any.whl
.
File metadata
- Download URL: djsuperadmin-0.11.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/37.2 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.12.0 keyring/23.9.3 rfc3986/2.0.0 colorama/0.4.5 CPython/3.9.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e63ee3eecb2e96e1d951b668f1b8ee614ec3b236f6206a2a3c29e5a76642344c |
|
MD5 | 584e50268c7b3e0834cfa937c7f5de3e |
|
BLAKE2b-256 | 143f7e3220195958f30ce7f913f510afa3cee84ab862d6a19554e5fc686f4b01 |