Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

list_display django foreign key

class UserAdmin(admin.ModelAdmin):
    list_display = (..., 'get_author')

    def get_author(self, obj):
        return obj.book.author
    get_author.short_description = 'Author'
    get_author.admin_order_field = 'book__author'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #foreign #key
ADD COMMENT
Topic
Name
1+2 =