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 trialWilliam Gough
18,852 PointsWhat am I missing?
Not sure what I'm doing wrong but it says that task 1 is no longer passing, another question on this topic said to import datetime but wasn't clear about whether this was importing from default python libraries or Flask.
from peewee import *
from flask import datetime
class User(Model):
email = CharField(unique=True)
password = CharField(max_length=100)
join_date = DateTimeField(default = datetime.datetime.now)
2 Answers
Zachary Hudson
Courses Plus Student 12,154 PointsYou're just importing it from the wrong place. It isn't imported from Flask, it's its own library.
from peewee import *
import datetime
class User(Model):
email = CharField(unique=True)
password = CharField(max_length=100)
join_date = DateTimeField(default = datetime.datetime.now)
This will pass.
Bryan Manhollan
Courses Plus Student 10,096 PointsI've looked over this quite a bit. As far as I can tell, this should pass steps 1 and 2, but doesn't
from peewee import *
class User(Model):
email = CharField(unique=True)
password = CharField(max_length=100)
join_date = DateTimeField(default=datetime.datetime.now)
It's getting an error stating that datetime is not defined, but datetime is stored within DateTimeField. I feel like this may be an issue on Treehouse backend, though I haven't tested this outside of Treehouse.
Looking at http://peewee.readthedocs.org/en/latest/peewee/models.html it shows an example where no other packages are imported, and datetime does not have to be specifically defined.
William Gough
18,852 PointsThank you Bryan, I appreciate your time looking over this! It's a bit frustrating as I don't want to move forward until I've completed that step.
Hopefully one of the staff will notice this and clarify the issue!