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! While you're at it, check out some resources Treehouse students have shared here.

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

Python Customizing the Django Admin Customizing the List View Test: Custom Attributes

Tobias Mahnert
Tobias Mahnert
89,414 Points

Whats missing?

Don't quite understand where to get the Course Information from

from django.db import models
import math 

class Step(models.Model):
    title = models.CharField(max_length=255)
    description = models.TextField()
    order = models.IntegerField(default=0)

    class Meta:
        abstract = True
        ordering = ['order',]

    def __str__(self):
        return self.title

class Quiz(Step):
    total_questions = models.IntegerField()

    def number_correct_needed(arg):
        needed = arg*.7
      return '{}'.format(math.ceil(float(needed))) + '/{}'.format(math.ceil(float(arg)))
from django.contrib import admin 

from . import models

class QuizAdmin(admin.ModelAdmin):
    list_display = ['title', 'course']

1 Answer