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.
Works with django-admin-action-forms.
It does one thing and one thing only.
🔌 Installation
-
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 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
File details
Details for the file django_no_queryset_admin_actions-1.1.0.tar.gz
.
File metadata
- Download URL: django_no_queryset_admin_actions-1.1.0.tar.gz
- Upload date:
- Size: 625.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3789659b57f303356fe1179988edb8c4791a7a4044ebeeff0ade8518b3a72336 |
|
MD5 | 299a94b6fbb5280ee5aed65d40f27cbc |
|
BLAKE2b-256 | 614050c7214fb3950defcda0a6ad9f30347d063509063e56aaadff5674105a3c |
File details
Details for the file django_no_queryset_admin_actions-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: django_no_queryset_admin_actions-1.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f28711ca0a10fb3905cab5e67eb231ce4e179840a8944dab220b53cc5f5443d |
|
MD5 | 33eeb4b2bf7cf39cc5b68429da8204e0 |
|
BLAKE2b-256 | d85bb30034194e130bd3c3d72347b8b7fdc37ef0404b664452bce64eb72fd594 |