Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Blessing Chiwaura18,037 Points
Add the lookups method to your TopicListFilter. Remember that this method takes self, request, and model_admin as argume
Add the lookups method to your TopicListFilter. Remember that this method takes self, request, and model_admin as arguments, and that you need to return a tuple of tuples.
For the tuples, add "Python", "Ruby", and "Java" as options and values. See the documentation if you get lost.
from django.contrib import admin from . import models class TextInline(admin.StackedInline): model = models.Text class QuizInline(admin.StackedInline): model = models.Quiz class AnswerInline(admin.StackedInline): model = models.Answer class TopicListFilter(admin.SimpleListFilter): title = 'topic' parameter_name = 'topic' def lookups(self, request, model_admin): return (('Python',_('Python','Python','Ruby')), ('Ruby',_('Python','Ruby','Java')), ('Java',_('Python','Ruby','Java'))) # ENTER YOUR CODE HERE. class CourseAdmin(admin.ModelAdmin): inlines = [TextInline, QuizInline] list_filter = ['created_at', 'is_live'] admin.site.register(models.Course, CourseAdmin)
Matt Galvis8,233 Points
def lookups(self, request, model_admin): return (('Python',('Python')), ('Ruby',('Ruby')), ('Java',('Java')))
only one for one.