1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00
royalnet/examplepack/tables/example.py
2020-06-21 16:38:25 +02:00

19 lines
505 B
Python

from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declared_attr
class Example:
__tablename__ = "examples"
@declared_attr
def creator_id(self):
return Column(Integer, ForeignKey("users.uid"), primary_key=True)
@declared_attr
def creator(self):
return relationship("User", backref=backref("examples_createdx"))
@declared_attr
def example(self):
return Column(String, nullable=False, default="Hello world!")