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 Django Basics Django Templates Step by Step

Arcee Palabrica
Arcee Palabrica
8,100 Points

My steps are not showing

I think I've followed what Kenneth has done. I've already added the steps in my admin but the StepInline doesn't seem to work... here are my codes:

from django.db import models


# Create your models here.
class Course(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)
    title = models.CharField(max_length=255)
    description = models.TextField()

    def __str__(self):
        return self.title

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

    def __str__(self):
        return self.title
from django.contrib import admin

from .models import Course, Step


class StepInline(admin.StackedInline):
    model = Step


class CourseAdmin(admin.ModelAdmin):
    inslines = [StepInline,]

# Register your models here.

admin.site.register(Course, CourseAdmin)
admin.site.register(Step)

I'm also sure I've added the steps
alt text

But when I look at python basics in Course the step/s isn't shown alt text

Am I missing something?

2 Answers

Ryan S
Ryan S
27,276 Points

Hi Arcee,

It looks like you have a typo in CourseAdmin. You have "inslines" instead of "inlines".

Arcee Palabrica
Arcee Palabrica
8,100 Points

Oh Thanks Ryan wow those small typos really are... :D It worked! thanks so much

If you edit your code within an editor such as Visual Code with the Python plugin, you can hit auto-complete to enter the inherited property name