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.3.tar.gz (12.3 kB view hashes)

Uploaded Source

Built Distribution

djsuperadmin-0.11.3-py2.py3-none-any.whl (12.5 kB view hashes)

Uploaded Python 2 Python 3

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