diff --git a/app/__init__.py b/app/__init__.py index 7a5e1b3..ce5d073 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -23,6 +23,7 @@ def create_app(environment="development"): user_blueprint, book_blueprint, home_blueprint, + section_blueprint, ) from app.models import ( User, @@ -50,6 +51,7 @@ def create_app(environment="development"): app.register_blueprint(user_blueprint) app.register_blueprint(book_blueprint) app.register_blueprint(home_blueprint) + app.register_blueprint(section_blueprint) # Set up flask login. @login_manager.user_loader diff --git a/app/models/section.py b/app/models/section.py index 29a500d..627d6fc 100644 --- a/app/models/section.py +++ b/app/models/section.py @@ -32,5 +32,20 @@ class Section(BaseModel): path += self.label return path + @property + def book_id(self): + _book_id = self.version.book_id + return _book_id + + @property + def sub_collection_id(self): + parent = self.collection + grand_parent = parent.parent + if grand_parent.is_root: + _sub_collection_id = parent.id + else: + _sub_collection_id = grand_parent.id + return _sub_collection_id + def __repr__(self): return f"<{self.id}: {self.label}>" diff --git a/app/templates/section/all.html b/app/templates/section/all.html new file mode 100644 index 0000000..d057694 --- /dev/null +++ b/app/templates/section/all.html @@ -0,0 +1,125 @@ + +{% extends 'base.html' %} +{% block content %} + +
{{ section.path }}
+55
+ + + + +55
+ +