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 Detail View Test: Customizing the Look

adding field sets in django admin.

has any one passed this challenge ? I keep getting the error, fields tuple needs a description field but I have included it in the dictionary.

courses/admin.py
from django.contrib import admin

from . import models

class TextInline(admin.StackedInline):
    model = models.Text

    fieldsets = (
        (None,{
            'fields':('title','order',)
        }),
        ('Add content',{
            'fields':('description','content',)
        })
    )

1 Answer

Ryan S
Ryan S
27,276 Points

Hi Andreas,

It looks like you are going a bit beyond what the challenge is asking for by creating an "Add content" title and separating the fields.

This challenge is looking for all the fields to be included under one section title (None).

To include fields on the same line, you just need to wrap them as a tuple inside the "fields" tuple value.

from django.contrib import admin

from . import models

class TextInline(admin.StackedInline):
    model = models.Text
    fieldsets = (
        (None, {
            'fields': (('title', 'order'), 'description', 'content')
        }),
    )

Hi Ryan,

Thanks for that, to much over thinking.