# DjSuperAdmin [![PyPI](https://img.shields.io/pypi/v/djsuperadmin?style=flat-square)](https://pypi.org/project/djsuperadmin/) ![Codecov](https://img.shields.io/codecov/c/github/lotrekagency/djsuperadmin?style=flat-square) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/lotrekagency/djsuperadmin/Test,%20Coverage%20and%20Release?style=flat-square) [![GitHub](https://img.shields.io/github/license/lotrekagency/camomilla?style=flat-square)](./LICENSE)
✍🏻 Edit contents directly on your page with Django
## Here how it works!
<img src="https://github.com/lotrekagency/djsuperadmin/raw/master/demo.gif" alt="DjSuperAdmin demo" style="width: 100%;">
## Installation
```sh
pip install djsuperadmin
```
## Setup
Add `djsuperadmin` to your `INSTALLED_APPS` in `settings.py`
```py
INSTALLED_APPS = [
# ...
'djsuperadmin'
]
```
And import all the required js files in the footer
```html
{% load djsuperadmintag %}
{% djsuperadminjs %}
```
## Usage
Define your `custom Content` model using `DjSuperAdminMixin` and provide an endpoint to GET/PATCH your content
```py
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
```html
{% load djsuperadmintag %}
...
<body>
<p>
{% superadmin_content your_object 'your_object_attribute' %}
</p>
</body>
```
Raw data
{
"_id": null,
"home_page": "https://github.com/lotrekagency/djsuperadmin",
"name": "djsuperadmin",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.0.*",
"maintainer_email": "",
"keywords": "cms,django,api cms",
"author": "Lotr\u00e8k",
"author_email": "dimmitutto@lotrek.it",
"download_url": "https://files.pythonhosted.org/packages/ea/34/56c02e64ab5329be358a481f5fa55f2f373ffed3f07c1c8f525bea43de0c/djsuperadmin-0.11.3.tar.gz",
"platform": null,
"description": "# DjSuperAdmin [![PyPI](https://img.shields.io/pypi/v/djsuperadmin?style=flat-square)](https://pypi.org/project/djsuperadmin/) ![Codecov](https://img.shields.io/codecov/c/github/lotrekagency/djsuperadmin?style=flat-square) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/lotrekagency/djsuperadmin/Test,%20Coverage%20and%20Release?style=flat-square) [![GitHub](https://img.shields.io/github/license/lotrekagency/camomilla?style=flat-square)](./LICENSE)\n\n\u270d\ud83c\udffb Edit contents directly on your page with Django\n\n\n## Here how it works!\n\n<img src=\"https://github.com/lotrekagency/djsuperadmin/raw/master/demo.gif\" alt=\"DjSuperAdmin demo\" style=\"width: 100%;\">\n\n## Installation\n\n```sh\npip install djsuperadmin\n```\n\n## Setup\n\nAdd `djsuperadmin` to your `INSTALLED_APPS` in `settings.py`\n\n```py\nINSTALLED_APPS = [\n # ...\n 'djsuperadmin'\n]\n```\n\nAnd import all the required js files in the footer\n\n```html\n{% load djsuperadmintag %}\n\n{% djsuperadminjs %}\n```\n\n## Usage\n\nDefine your `custom Content` model using `DjSuperAdminMixin` and provide an endpoint to GET/PATCH your content\n\n```py\nfrom django.db import models\nfrom djsuperadmin.mixins import DjSuperAdminMixin\n\n\nclass GenericContent(models.Model, DjSuperAdminMixin):\n\n identifier = models.CharField(max_length=200, unique=True)\n content = models.TextField()\n\n @property\n def superadmin_get_url(self):\n return f'/api/content/{self.pk}'\n\n @property\n def superadmin_patch_url(self):\n return f'/api/content/{self.pk}'\n```\n\nThen in your template\n\n```html\n{% load djsuperadmintag %}\n\n...\n\n<body>\n <p>\n {% superadmin_content your_object 'your_object_attribute' %}\n </p>\n</body>\n```\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Edit contents directly on your page with Django",
"version": "0.11.3",
"split_keywords": [
"cms",
"django",
"api cms"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "acb2d8b033d8bdef33a58fe7c90306a8",
"sha256": "6496f9720de78f2ece57949131dc02b143a78b5b8dd1ec73ca87de78129a05af"
},
"downloads": -1,
"filename": "djsuperadmin-0.11.3-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "acb2d8b033d8bdef33a58fe7c90306a8",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.0.*",
"size": 12476,
"upload_time": "2022-09-30T15:40:52",
"upload_time_iso_8601": "2022-09-30T15:40:52.926414Z",
"url": "https://files.pythonhosted.org/packages/68/4e/2ef5853c06f9f837e17ef41b55cd8592245075e37150c94b6807cc6b1913/djsuperadmin-0.11.3-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "d643730e5bfc0b83797dec4ba7cdb035",
"sha256": "ad4879ff1d9b2b933c60877f6a2ff4a770533e521f4e2b7c7224692e783889e2"
},
"downloads": -1,
"filename": "djsuperadmin-0.11.3.tar.gz",
"has_sig": false,
"md5_digest": "d643730e5bfc0b83797dec4ba7cdb035",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.0.*",
"size": 12258,
"upload_time": "2022-09-30T15:40:54",
"upload_time_iso_8601": "2022-09-30T15:40:54.556346Z",
"url": "https://files.pythonhosted.org/packages/ea/34/56c02e64ab5329be358a481f5fa55f2f373ffed3f07c1c8f525bea43de0c/djsuperadmin-0.11.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-09-30 15:40:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "lotrekagency",
"github_project": "djsuperadmin",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "djsuperadmin"
}