Setting up a Django admin using list_display?

I am trying to configure Django Admin.

models.py 
=============
class Question(models.Model):
    poll = models.ForeignKey(Poll)
    name = models.CharField(max_length=100)
    pub_date = models.DateTimeField('date published')

admin.py
===========   
class QuestionAdmin(admin.ModelAdmin):
    list_display = ('name', 'poll'. 'pub_date')
    inlines = [ChoiceInline]

admin.site.register(Question)

This seems to be the right setting to configure QuestionIndex.
I want it displayed:
  What is your question? introPoll July 31, 2009

However, the Question index only displays unicode by default.

Am I missing a step?

What could be the reasons why additional data is not displayed in the index?

+3
source share
1 answer

You must specify the admin class in the function admin.site.registerif you configured it:

admin.site.register(Question, QuestionAdmin)

, , , list_display , : ('name', 'poll'. 'pub_date') ('name', 'poll', 'pub_date').

+15

Source: https://habr.com/ru/post/1714101/


All Articles