You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
suchwow/suchwow/models.py

51 lines
1.2 KiB
Python

from peewee import *
from datetime import datetime
from suchwow import config
4 years ago
db = SqliteDatabase(f"{config.DATA_FOLDER}/db/sqlite.db")
class Post(Model):
id = AutoField()
title = CharField()
text = CharField()
# submitter = ForeignKeyField(Profile, field=Profile.username)
submitter = CharField()
image_name = CharField()
readonly = BooleanField(default=False)
hidden = BooleanField(default=False)
account_index = IntegerField()
address_index = IntegerField()
timestamp = DateTimeField(default=datetime.now)
class Meta:
database = db
class Profile(Model):
id = AutoField()
username = CharField()
address = CharField()
4 years ago
notifications = IntegerField(default=0)
class Meta:
database = db
class Comment(Model):
id = AutoField()
comment = TextField()
4 years ago
commenter = ForeignKeyField(Profile)
post = ForeignKeyField(Post)
timestamp = DateTimeField(default=datetime.now)
class Meta:
database = db
class Notification(Model):
type = CharField()
message = TextField()
4 years ago
username = ForeignKeyField(Profile)
timestamp = DateTimeField(default=datetime.now)
class Meta:
database = db