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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Terri Valentine](https://secure.gravatar.com/avatar/7c4db389536b6d681ea2adb1bc619380?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Terri Valentine
23,034 Pointsimport 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")
1 Answer
![ursaminor](https://uploads.teamtreehouse.com/production/profile-photos/5415492/micro_suprised_koala_eating_leaf.jpg)
ursaminor
11,271 PointsThe functions are inside the class so they have to be indented properly. They should line up with class Meta.