The "Django Admin Related" prevents you from deleting your models if you have related items
Project description
Django Admin Related
====================
this project makes it impossible for the user to delete objects that contain other objects related by django admin
Obs: this project works only in django admin
# Install:
pip install django-admin-related
# Usage:
1. Add to your INSTALLED_APPS, in settings.py:
INSTALLED_APPS = [
...
'django_admin_related',
...
]
2. Create admin for your model:
from django.contrib.admin import register
from django_admin_related.admin import VerifyRelated
@register(YouModel)
class YouModelAdmin(VerifyRelated):
pass
3. Test:
try this: create a simple model, and simple related model, and exclude a first model.
# Advanced:
1. if you need to specify relationships, you can do so :
from django.contrib.admin import register
from django_admin_related.admin import VerifyRelated
@register(YouModel)
class YouModelAdmin(VerifyRelated):
verify_related_fields = ('field', 'field2', ...)
====================
this project makes it impossible for the user to delete objects that contain other objects related by django admin
Obs: this project works only in django admin
# Install:
pip install django-admin-related
# Usage:
1. Add to your INSTALLED_APPS, in settings.py:
INSTALLED_APPS = [
...
'django_admin_related',
...
]
2. Create admin for your model:
from django.contrib.admin import register
from django_admin_related.admin import VerifyRelated
@register(YouModel)
class YouModelAdmin(VerifyRelated):
pass
3. Test:
try this: create a simple model, and simple related model, and exclude a first model.
# Advanced:
1. if you need to specify relationships, you can do so :
from django.contrib.admin import register
from django_admin_related.admin import VerifyRelated
@register(YouModel)
class YouModelAdmin(VerifyRelated):
verify_related_fields = ('field', 'field2', ...)
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
Close
Hashes for django-admin-related-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18ce2f0c4fd6f3ccb24d1fec73f33e1eb400cf28e3358dc5be2116483b82b0da |
|
MD5 | c13af6d9127463956fffde42db9b9efc |
|
BLAKE2b-256 | 11c0c286926aff9c265aebaeee92a8fc8d203b02a238a8eb0405931ac5417f65 |