A Django app that adds admin curations for custom models.
Project description
Django Model Curation
Adds a simple but flexible curation environment to admin panel for django models.
Install:
pip install django-model-curation
Example Use:
models.py:
from django.db import models
from django_model_curation.models import AbstractCuration
class Book(models.Model):
pass
class BookCuration(AbstractCuration, models.Model):
book = models.OneToOneField(
to=Book,
on_delete=models.CASCADE,
related_name="curation",
blank=True,
null=True,
)
# This property is required by AbstractCuration
@property
def curation_object(self):
return self.book
admin.py
from django.contrib import admin
from models import BookCuration
from django_model_curation.admin import GenericCurationModelAdmin
@admin.register(BookCuration)
class BookCurationModelAdmin(GenericCurationModelAdmin):
pass
complement your own business logic by accessing the field status,
for example show only curated objects on your website.
from django_model_curation.models import (
CURATION_PENDING,
CURATION_ACCEPTED,
CURATION_RECALLED_BY_USER,
CURATION_UPDATE_BY_USER,
CURATION_REJECTED_PERMANENTLY,
CURATION_REJECTED_TEMPORARILY
)
def get_curated_books():
return Books.objects.filter(curation__status=CURATION_ACCEPTED)
Admin Permissions
actions:
{{model}}_can_revert_curation
{{model}}_can_accept_curation
{{model}}_can_reject_curation_permanently
{{model}}_can_reject_curation_temporarily
meta:
{{model}}_allow_actions_on_accepted
{{model}}_allow_actions_on_rejected
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_model_curation-0.0.0.tar.gz.
File metadata
- Download URL: django_model_curation-0.0.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7964503a3d73d481498a66244b4152e6f3dcdc56383f2ab1ef52f5bd93846f3b
|
|
| MD5 |
b64bab7da1f81a64a4351a393b0871f7
|
|
| BLAKE2b-256 |
5f476167ff125a3a6e058ca068c5a1325c87f73f09a17c77050dbef0f54dd10a
|
File details
Details for the file django_model_curation-0.0.0-py3-none-any.whl.
File metadata
- Download URL: django_model_curation-0.0.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52abd7d1f4fafe1556bb20e846a7b8de023d31429d743f582049df2ed4f1f3ae
|
|
| MD5 |
307e212984d16635a6790a1e281347f1
|
|
| BLAKE2b-256 |
a5bd76433ae1848da2629bf5143cf48552477f4c2af5b1be75397eff9ce3e0c1
|