You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
suchwow/suchwow/models.py

51 lines
1.2 KiB

from peewee import *
from datetime import datetime
from suchwow import config
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()
notifications = IntegerField()
class Meta:
database = db
class Comment(Model):
id = AutoField()
comment = TextField()
commenter = ForeignKeyField(Profile, field=Profile.username)
post = ForeignKeyField(Post, field=id)
timestamp = DateTimeField(default=datetime.now)
class Meta:
database = db
class Notification(Model):
type = CharField()
message = TextField()
username = ForeignKeyField(Profile, field=Profile.username)
timestamp = DateTimeField(default=datetime.now)
class Meta:
database = db