Django disable editing (but allow adding) in TabularInline view

Posted by VoteyDisciple on Stack Overflow See other posts from Stack Overflow or by VoteyDisciple
Published on 2010-06-01T17:10:34Z Indexed on 2010/06/01 17:13 UTC
Read the original article Hit count: 585

Filed under:
|

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 have this trivial setup:

class SuperviseeAdmin(admin.TabularInline):
  model = Supervisee

class SupervisorAdmin(admin.ModelAdmin):
  inlines = [SuperviseeAdmin]

admin.site.register(Supervisor, SupervisorAdmin)

I have tried adding a has_change_permission function to SuperviseeAdmin that returns False unconditionally, but it had no effect.

I have tried setting actions = None in SuperviseeAdmin but it had no effect.

What might I be overlooking that could get this to work?

© Stack Overflow or respective owner

Related posts about django

Related posts about django-admin