How to use can_add_related in Django Admin

后端 未结 3 1804
一个人的身影
一个人的身影 2020-12-19 01:39

I\'ve read about the can_add_related feature here: https://code.djangoproject.com/ticket/9071

I tried using it this way:

def get_form(self, request,          


        
3条回答
  •  北海茫月
    2020-12-19 01:53

    can_add_related seems to be an attribute on the widget, not the field, so try:

    self.fields['person'].widget.can_add_related = False
    

提交回复
热议问题