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 trialmichaelangelo owildeberry
18,173 Pointswhy is this not passing? please help =)
Challenge Task 1 of 2
Add a @classmethod to User named new. It should take two arguments, email and password. The body of the method can be pass for now. Remember, @classmethods take cls as the first argument. ... why is this not passing? please help =)
import datetime
from flask.ext.bcrypt import generate_password_hash
from flask.ext.login import UserMixin
from peewee import *
database = SqliteDatabase(':memory:')
class User(Model):
email = CharField(unique=True)
password = CharField(max_length=100)
join_date = DateTimeField(default=datetime.datetime.now)
bio = CharField(default='')
class Meta:
database = database
@classmethod
def new(email, password);
pass
3 Answers
qasimalbaqali
17,839 PointsYou forgot the cls as the first argument and you used a semi colon instead. So it should look like
@classmethod
def new(cls, email, password):
pass
Kenneth Love
Treehouse Guest TeacherYou don't need to indent the method past the decorator. You also didn't give a body to your method and method blocks start with a colon, :
, not a semicolon, ;
. And, finally, you didn't provide an argument for the class.
Tafadzwa Timothy Gakaka
10,978 PointsKenneth can you post the full code
Andrew Winkler
37,739 PointsTrying the code above only got me indentation errors. After reviewing Kenneth's comments, I got this to work though:
@classmethod
def new(cls, email, password):
pass
Indentation errors begone!
michaelangelo owildeberry
18,173 Pointsmichaelangelo owildeberry
18,173 PointsChallenge Task 1 of 2
Add a @classmethod to User named new. It should take two arguments, email and password. The body of the method can be pass for now. Remember, @classmethods take cls as the first argument.