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

Uploaded Source

Built Distribution

djsuperadmin-0.11.2-py2.py3-none-any.whl (12.4 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: djsuperadmin-0.11.2.tar.gz
  • Upload date:
  • Size: 12.2 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

Hashes for djsuperadmin-0.11.2.tar.gz
Algorithm Hash digest
SHA256 88319f3002cdb205823ed640888779d1a0b9f908b8dda138d61babebe9109acb
MD5 9e5a9e4946957c8e9b2661178a9c173c
BLAKE2b-256 a029bd66df9e8618b1092b29b53a16e4e7cdf96beb7be0c4e12f17239ae313af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: djsuperadmin-0.11.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.4 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

Hashes for djsuperadmin-0.11.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bc0187858505cd8b987c3d89f2a424d7e4397587e3cd88c513aa5f6fc953203f
MD5 0c9128dcd205865321419f4905eb5b62
BLAKE2b-256 266b59d9c17b0f91c4d21d49beea48f606721c2354ece18d1bbb3dfe6b89a6c1

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