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.
import datetime from peewee import * from argon2 import PasswordHasher DATABASE = SqliteDatabase('recipes.d
I am still getting an error message and my code will not pass.
import datetime from peewee import * from argon2 import PasswordHasher DATABASE = SqliteDatabase('recipes.db') HASHER = PasswordHasher() class User(Model): username = CharField(unique=True) password = CharField() class Meta: database = DATABASE @staticmethod def hash_password(password): #function takes in user password and hashes it return HASHER.hash(password) @classmethod def create_user(cls, username, password): try: cls.get(cls.username**username) except cls.DoesNotExist: user = cls(username=username) user.password = cls.hash_password(password) #Here the class instance is calling the static method we just made user.save() return user else: raise Exception("User already exists")
The functions are inside the class so they have to be indented properly. They should line up with class Meta.