Skip to main content

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

  1. Install using pip:

    $ pip3 install django-no-queryset-admin-actions
    
  2. Add 'django_no_queryset_admin_actions' to your INSTALLED_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

django_no_queryset_admin_actions-1.1.0.tar.gz (625.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django_no_queryset_admin_actions-1.1.0.tar.gz.

File metadata

File hashes

Hashes for django_no_queryset_admin_actions-1.1.0.tar.gz
Algorithm Hash digest
SHA256 3789659b57f303356fe1179988edb8c4791a7a4044ebeeff0ade8518b3a72336
MD5 299a94b6fbb5280ee5aed65d40f27cbc
BLAKE2b-256 614050c7214fb3950defcda0a6ad9f30347d063509063e56aaadff5674105a3c

See more details on using hashes here.

File details

Details for the file django_no_queryset_admin_actions-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_no_queryset_admin_actions-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f28711ca0a10fb3905cab5e67eb231ce4e179840a8944dab220b53cc5f5443d
MD5 33eeb4b2bf7cf39cc5b68429da8204e0
BLAKE2b-256 d85bb30034194e130bd3c3d72347b8b7fdc37ef0404b664452bce64eb72fd594

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page