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.

Alex Eastwood
Python Development Techdegree Graduate 17,230 PointsNo value for argument 'model' in constructor call
class Post(Model):
timestamp = DateTimeField(default=datetime.datetime.now)
user = ForeignKeyField(
rel_model=User,
related_name='posts'
)
content = TextField()
class Meta:
database = DATABASE
order_by = ('-timestamp',)
This code is throwing the above error. Googling it, every post is saying that i'm missing a positional argument in my init function but the class as Kenneth writes it doesnt have one, so I have no idea what's going wrong.
2 Answers

Alex Eastwood
Python Development Techdegree Graduate 17,230 PointsDon't know if it's just the video is out of date but the peewee documentation gives the user assignment to be
user = ForeignKeyField(User, backref='posts')
and that fixed it. Just in case anyone else gets this issue.

MengHsin Ou
5,317 Pointsuser = ForeignKeyField(
model={User}, # added
rel_model=User, # point to the User model
related_name='posts' # who call and name their post
)
I tried to see the document and added to fix it.
Chris Freeman
Treehouse Moderator 67,982 PointsChris Freeman
Treehouse Moderator 67,982 PointsI've marked you question as "feedback" so the developers will see it. Thanks!