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 trialEric Shelby
28,300 PointsCreate a Model Form Challenge
According to the instructions: 'We need to make a model form for our Digital product model. We have a couple of fields on Product, its parent, though, that we don't want in our form.
Make a model form for Digital and name the form class DigitalProductForm. Only include the name, description, and url fields.'
However, I don't how to turn a model form for Digital. The lesson didn't cover that. I tried a few ways, but none of them worked. A hint would be appreciaed.
from django import forms
from . import models
class DigitalProductForm(forms.ModelForm)
class Meta:
model = models.DigitalProduct
fields = ['name', 'description', 'url',]
2 Answers
Chris Freeman
Treehouse Moderator 68,457 PointsYou are very close! There is a colon missing from the end of the class definition. While the form is DigitalProductsForm
, the model it's based on is Digital
not DigitalProducts
. Fix these and it should pass.
Post back if you need more help. Good luck!!
Eric Shelby
28,300 PointsThanks, Chris. Your advice did the trick.