Extension for the Django admin panel that makes it possible to add actions that do not require a queryset to run.
Project description
django-no-queryset-admin-actions
Extension for the Django admin panel that makes it possible to add actions that do not require a queryset to run.
It does one think and one thing only.
🔌 Instalation
-
Install using
pip
:$ pip3 install django-no-queryset-admin-actions
-
Add
'django_no_queryset_admin_actions'
to yourINSTALLED_APPS
setting.INSTALLED_APPS = [ ... 'django_no_queryset_admin_actions', ]
✏️ Example
Let's say you have an action that fetches external orders from an API. You don't need a queryset to run this action, but Django requires it by default. By using this extension, you can add bypass that, and create actions that can be run without selecting any objects.
from django.contrib.admin import ModelAdmin, register, action
from django_no_queryset_admin_actions import NoQuerySetAdminActionsMixin
@register(ExternalOrder)
class ExternalOrderAdmin(NoQuerySetAdminActionsMixin, ModelAdmin):
...
@action(description="Fetch external orders")
def fetch_external_orders(self, request): # <- No `queryset` parameter
...
actions = ["fetch_external_orders"]
no_queryset_actions = ["fetch_external_orders"]
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
Built Distribution
Close
Hashes for django_no_queryset_admin_actions-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8095ad72c2a05fedfe44996d6fdf5e93e22542aac571e6ec77610d1208d9214 |
|
MD5 | 63de1410605fad93bb3367cae111fcf1 |
|
BLAKE2b-256 | 7ea13532edf5445a03a6dbcc21e4d07f8cbe3689acd745db9978cd3502619c71 |
Close
Hashes for django_no_queryset_admin_actions-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d5dae3db3c2dd03461f5a5f5a0ed35e52f2e8bd3179a30fd57dba44454ab2fa |
|
MD5 | 7a9f5983796f9fb003b29e72158ae678 |
|
BLAKE2b-256 | d8bc1ebf94386187148d4d906f3b36d540116d2bd7fb6fd17cfef6298a1a5627 |