Search code examples
pythonflaskjinja2adminflask-admin

flask-admin How to customize delete button


I want to customize the delete button In flask admin

Here I have logged in through credential of aakash ,who is an admin. Asish is normal user and pravin is super admin. AAkash can delete normal user but he can not delete superadmin.In short i want to remove the delete button beside pravin and give delete button beside asish.how to do this?


Solution

  • You can use if condition and check whether the user is normal user, superuser or admin. If the user is admin then you check who are the normal users and make a array and store the normal users. Now you can use a loop to loop the normal users array which we created. In side of the loop you can show your delete button because they are normal users which you want to give a delete button.