Django disable editing (but allow adding) in TabularInline view

前端 未结 4 2259
小鲜肉
小鲜肉 2021-02-19 23:40

I want to disable editing ALL objects within a particular TabularInline instance, while still allowing additions and while still allowing editing of the parent model.

I

4条回答
  •  日久生厌
    2021-02-19 23:51

    class SuperviseeAdmin(admin.TabularInline):
      model = Supervisee
    
      def __init__(self, *args, **kwargs):
            super(SuperviseeAdmin, self).__init__(*args, **kwargs)
            self.list_display_links = (None, )
    

提交回复
热议问题