python - Relational Mapping using Peewee -


i'm new relational databases , i'm quite confused on how should create models. need need done filter posts content through language choice , need create relational database. doubt comes when deciding how many models(tables) should have accomplish this. here example:

models.py

class post(model):     timestamp = datetimefield(default=datetime.datetime.now)     user = foreignkeyfield(         rel_model=user,         related_name='posts'     )     language = textfield()     content = foreignkeyfield(this needs point language)      class meta:         database = database 

is possible accomplish this? should create more 1 post model?

thank in advanced.

have run through quickstart guide? doing might give feel how create models , set relationships:

http://docs.peewee-orm.com/en/latest/peewee/quickstart.html

to answer immediate question, can create table language, i.e.

class language(model):     name = charfield()      class meta:         database = database 

so you'd have (cleaned bit):

database = sqlitedatabase('mydb.db') # or postgresqldatabase or mysqldatabase  class basemodel(model):     class meta:         database = database  class user(basemodel):     email = charfield()     # whatever other user fields  class language(basemodel):     name = charfield()     # other fields?  class post(basemodel):     timestamp = datetimefield(default=datetime.datetime.now)     user = foreignkeyfield(user, related_name='posts')     language = textfield()     content = foreignkeyfield(language, related_name='posts')