Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Flask REST API Resourceful Blueprints Ingredient Resource

Okay still having trouble

So this is my third or forth time trying to solve this question. I've re-watched the related video, double checked my work and fixed all the problems that I could see in my code and I still can't get my answer accepted.

It's a little annoying that: 1.) There is no helpful error message that can point me in the right direciton 2.) I can't check the q/a second right here on the question screen. I either have to post another question or go to the community page and search around.

models.py
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 = DecimalField()
    measurement_type = CharField()
    recipe = ForeignKeyField(Recipe)

    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
resources/ingredients.py
from flask.ext.restful import Resource

import models

class IngredientList(Resource):
    def get(self):
        return 'this is a string'

class Ingredient(Resource):
    def get(self, id):
        return 'this is a string'

1 Answer

Chris Jones
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Chris Jones
Java Web Development Techdegree Graduate 23,921 Points

Well, I literally copied both of the files you included above over the existing Treehouse code and passed both tasks. Can you try doing that and see if it passes?

¯\_(ツ)_/¯

Okay that worked. Not sure what happened earlier...