开发者

How to implement custom admin actions in non-custom-models in Django?

开发者 https://www.devze.com 2022-12-13 02:29 出处:网络
I\'d like to build a custom admin action into a model defined by Django. Let\'s say I wan开发者_开发百科ted to add the action \"Activate selected User(s)\" on django.contrib.auth.models.User in the Dj

I'd like to build a custom admin action into a model defined by Django. Let's say I wan开发者_开发百科ted to add the action "Activate selected User(s)" on django.contrib.auth.models.User in the Django admin interface. What would be the clean and proper way to accomplish this?

I had a look at the documentation but it's just about implementing admin actions in custom models if I looked correctly.


admin.site.unregister(User)
admin.site.register(User, YourUserAdmin)
0

精彩评论

暂无评论...
验证码 换一张
取 消