Changes between Initial Version and Version 1 of Ticket #30028, comment 2


Ignore:
Timestamp:
Dec 12, 2018, 10:01:39 AM (6 years ago)
Author:
ksl

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30028, comment 2

    initial v1  
    33The situation is actually more complex but boils down to the fact that `has_change_permission` is called with `obj=None`.
    44This does not allow individual objects (rows) in the changelist to be editable while others are not: either the whole changelist is editable or it's not. Or am I missing something here?
     5
     6----
     7
     8Edit:
     9
     10The admin to reproduce this could be:
     11
     12{{{
     13class ArticleAdmin(models.ModelAdmin):
     14        list_display = ("title", "author", "abstract")
     15        list_editable = ("title", "author")
     16
     17        def has_change_permission(self, request, obj=None):
     18                if obj is not None:
     19                        return obj.pk == 1
     20}}}
     21
     22In such a case (which is closer to our actual use case), the Article object with ID 1 will not be editable through its changeform but would be through its changelist.
Back to Top