Django 1.7 removing Add button from inline form

后端 未结 4 1691

I\'m having problems achieving a (probably) rather simple task. I have fully modifiable models (Prodotto, Comune) which are shown as \"addable\" fields, as shown in picture

4条回答
  •  萌比男神i
    2020-12-16 01:10

    To remove the "Add another" option, please add the below method in admin inline class.

    def has_add_permission(self, request):
        return False
    

    Similarly if you want to disable "Delete?" option, add the following method in admin inline class.

    def has_delete_permission(self, request, obj=None):
        return False
    

提交回复
热议问题