B
B
BEKa T2019-03-21 21:23:12
Django
BEKa T, 2019-03-21 21:23:12

Admin panel?

How to make it so that the admin panel displays the titles of the posts, and not the Post object (N)?7usMEQbuOFY.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2019-03-21
@Bread09

Define the __str__ method in the model , which returns a string with the desired representation.

M
Max Cage, 2019-03-22
@zulune

In admin.py you can write

admin.register(Post)
class PostAdmin(admin.ModelAdmin):
    list_display = ('title', ) # Перечислете нужные поля для отображения

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question