Skip to main content

Edit contents directly on your page with Django

Project description

✍🏻 Edit contents directly on your page with Django

Latest Version codecov Build Status License: MIT

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

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

Uploaded Source

Built Distribution

djsuperadmin-0.9.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: djsuperadmin-0.9.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/18.2 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.0

File hashes

Hashes for djsuperadmin-0.9.0.tar.gz
Algorithm Hash digest
SHA256 e5bbb2cdfe7a53946efb1dac9693fe20e46d53f31182cdad87477c6acf5a17bb
MD5 f06f241c95a60e93379e4e4a0cfe4690
BLAKE2b-256 26b2d2d50bdceb1bd03333bfd913507c2b73fe55b9ae139a2e2eb3c1aef2e64a

See more details on using hashes here.

File details

Details for the file djsuperadmin-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: djsuperadmin-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/18.2 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.0

File hashes

Hashes for djsuperadmin-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 419852ff31ea4a7071e79fb6c04dc21bbc8208408c26a20da297f18fd9e761de
MD5 65fac5922509eab04c355654ab4c7778
BLAKE2b-256 c6dfe8a2130ce9fba804895fccaa49488850c7959fb91eb9dfd94be30b267405

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