Search code examples
pythondjangoobjectadmin

DJANGO | How to make the object in the application take the value of the name when viewing the list


https://i.sstatic.net/30M2y.jpg - Image Admin Panel

Admin Code:

from django.contrib import admin
from .models import Destination

admin.site.register(Destination)

Summery: I did dynamic migration to the main page. I want the name of the destination to be accepted in the list in admin panel. How to do it?


Solution

  • I resolved problem:

    from django.contrib import admin
    from .models import Destination
    
    class DestinationAdmin(admin.ModelAdmin):
        list_display = ('name',) #I taking value from list of object.
    
    admin.site.register(Destination, DestinationAdmin)
    

    Nekain helped me