Reputation: 12244
I'm trying to customize the 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)
That seems to be the correct setup for customizing the QuestionIndex.
I want this displayed:
What is your question? introPoll July 31, 2009
However, the only the default unicode is showing up on the Question index.
Am I missing a step?
What could be some reasons the additional data is not being displayed on the index?
Upvotes: 4
Views: 5329
Reputation: 879
You must specify the admin class in the admin.site.register
function if you've customized it:
admin.site.register(Question, QuestionAdmin)
Also, I assume it's a typo, but the list_display
has a period where there should be a comma: ('name', 'poll'. 'pub_date')
should be ('name', 'poll', 'pub_date')
.
Upvotes: 16