Skip to main content

Edit contents directly on your page with Django

Project description

DjSuperAdmin PyPI Codecov GitHub Workflow Status GitHub

✍🏻 Edit contents directly on your page with Django

Here how it works!

DjSuperAdmin demo

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.10.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

djsuperadmin-0.10.0-py2.py3-none-any.whl (9.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file djsuperadmin-0.10.0.tar.gz.

File metadata

  • Download URL: djsuperadmin-0.10.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for djsuperadmin-0.10.0.tar.gz
Algorithm Hash digest
SHA256 3cde13f29090ce3cc8ab9a2b93ff3c855f147392158bc40ee2ef20017902aabf
MD5 dd12495ec21ad80e188ccbcd9a9b944b
BLAKE2b-256 ebab46d8941b3a4daeb474a13a887da9203b296935fd30467bb1d8c75e3aad6d

See more details on using hashes here.

File details

Details for the file djsuperadmin-0.10.0-py2.py3-none-any.whl.

File metadata

  • Download URL: djsuperadmin-0.10.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for djsuperadmin-0.10.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 eb12864275e9d73e60d16cc32217199050b3f3365c138449ad7f55b6c05f83e3
MD5 b62fc6f220b19160635ef87daf84d691
BLAKE2b-256 a20ab6fd965f102a6430ecb6a173d6c9335e3cacb5a7b8b24354820c7ca30835

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page