Bogdanp / django_dramatiq

A Django app that integrates with Dramatiq.
https://dramatiq.io
Other
331 stars 77 forks source link

Django Admin: allowed actions in Django Dramatiq Tasks #29

Closed CapedHero closed 5 years ago

CapedHero commented 5 years ago

First of all, I would like to express my appreciation of your work. I strongly believe that Dramatiq really matters and is a total blast!

I have a question regarding Tasks model in Django Dramatiq App in Django Admin.

Is it necessary to allow users to Add/Edit/Delete the Tasks via Django Admin? I see no business reason to do that. I perceive this app as a Dramatiq Tasks log viewer rather than some kind of dispatcher. What is more, I receive the below error when I blindly try to add a new Task:

image

What do you think about making Tasks model read-only in Django Admin? It is easily achievable by adding the below to TaskAdmin:

def has_add_permission(self, request):
    return False

def has_change_permission(self, request, task=None):
    return False

def has_delete_permission(self, request, task=None):
    return False
Bogdanp commented 5 years ago

Makes sense to me. If you're willing to make a PR with this change, I'll accept it.

Bogdanp commented 5 years ago

30 has been merged.