15 lines
467 B
Python
15 lines
467 B
Python
from cpl.database.abc import DbModelDaoABC
|
|
from model.author_dao import AuthorDao
|
|
from model.post import Post
|
|
|
|
|
|
class PostDao(DbModelDaoABC[Post]):
|
|
|
|
def __init__(self, authors: AuthorDao):
|
|
DbModelDaoABC.__init__(self, Post, "posts")
|
|
|
|
self.attribute(Post.author_id, int, db_name="authorId")
|
|
self.reference("author", "id", Post.author_id, "authors", authors)
|
|
|
|
self.attribute(Post.title, str)
|
|
self.attribute(Post.content, str) |