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?
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')
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With