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
Don't know what I'm missing
This is my code so far but my answer is not accepted. Can anyone explain why?
import datetime from peewee import * DATABASE = SqliteDatabase('recipes.db') class Recipe(Model): name = CharField() created_at = DateTimeField(default=datetime.datetime.now) class Meta: database = DATABASE class Ingredient(Model): name = CharField() description = CharField() quantity = FloatField() measurement_type = CharField() recipe = ForeignKeyField() class Meta: database = DATABASE # TODO: Ingredient model # name - string (e.g. "carrots") # description - string (e.g. "chopped") # quantity - decimal (e.g. ".25") # measurement_type - string (e.g. "cups") # recipe - foreign key
from flask.ext.restful import Resource import models
Quantity should be a decimal field (see comment). For recipe, you tell it that it's a foreign key but not the model that it points to, ie Recipe.