babbaggeii
babbaggeii

Reputation: 7727

extending django admin model

The default view for a model on the django admin page shows a list of items in that view, but only gives one field. How is it possible to show multiple fields in the list?

Upvotes: 0

Views: 241

Answers (2)

bekir çelik
bekir çelik

Reputation: 168

You can set list_display as like example;

@admin.register(Personal)
class PersonalAdmin(admin.ModelAdmin):
    list_display=('id','name','surname','phone',)

Upvotes: 1

babbaggeii
babbaggeii

Reputation: 7727

I've found the function list_display() that does this job exactly:

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

Upvotes: 2

Related Questions