I dont want to show the recent action widget in django admin site.I don't know how to get this done.
html template to disable the display. There's a sidebar block you might want to change/remove. Conditionally enabling or disabling actions ModelAdmin. get_actions(request) Finally, you can conditionally enable or disable actions on a per-request (and hence per-user basis) by overriding ModelAdmin.
Django admin allows access to users marked as is_staff=True . To disable a user from being able to access the admin, you should set is_staff=False . This holds true even if the user is a superuser. is_superuser=True .
Answer 1: You can add another class called Meta in your model to specify plural display name. For example, if the model's name is Category , the admin displays Categorys , but by adding the Meta class, we can change it to Categories .
you can override the admin/index.html
template to disable the display. There's
a sidebar block you might want to change/remove.
Conditionally enabling or disabling actions ModelAdmin.get_actions(request) Finally, you can conditionally enable or disable actions on a per-request (and hence per-user basis) by overriding ModelAdmin.get_actions().
This returns a dictionary of actions allowed. The keys are action names, and the values are (function, name, short_description) tuples.
Most of the time you'll use this method to conditionally remove actions from the list gathered by the superclass. For example, if I only wanted users whose names begin with 'J' to be able to delete objects in bulk, I could do the following:
class MyModelAdmin(admin.ModelAdmin):
...
def get_actions(self, request):
actions = super(MyModelAdmin, self).get_actions(request)
if request.user.username[0].upper() != 'J':
del actions['delete_selected']
return actions
i edited the answer you may find more like this at https://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With