summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/__init__.py3
-rw-r--r--src/controllers/__init__.py5
-rw-r--r--src/controllers/comments_controller.py12
-rw-r--r--src/controllers/dashboard_controller.py6
4 files changed, 20 insertions, 6 deletions
diff --git a/config/__init__.py b/config/__init__.py
index 1f79ed9..b23d088 100644
--- a/config/__init__.py
+++ b/config/__init__.py
@@ -2,7 +2,7 @@ import tomllib
import re
import sqlalchemy.exc as sqlalchemy_exceptions
from src.database import db, init_db
-from src.database.models.blog import Blog
+from src.database.models import Blog
import src.controllers as app_controllers
with open('config.toml', 'rb') as config_file:
@@ -49,6 +49,7 @@ def initialize_blueprints(app):
controller_regex = re.compile('_controller$')
controllers = [definition for definition in dir(app_controllers)
if controller_regex.search(definition) is not None]
+ breakpoint()
for controller in controllers:
# Remove the _controller substring from the controller name,
diff --git a/src/controllers/__init__.py b/src/controllers/__init__.py
index d9ad692..0fa79a7 100644
--- a/src/controllers/__init__.py
+++ b/src/controllers/__init__.py
@@ -1,3 +1,2 @@
-from flask import Blueprint, current_app
-
-dashboard_blueprint = Blueprint('dashboard_controller', '__dashboard_controller__')
+import src.controllers.comments_controller
+import src.controllers.dashboard_controller
diff --git a/src/controllers/comments_controller.py b/src/controllers/comments_controller.py
new file mode 100644
index 0000000..9077ba1
--- /dev/null
+++ b/src/controllers/comments_controller.py
@@ -0,0 +1,12 @@
+from flask import Blueprint, request
+from src.database.models import Blog, Comment
+
+
+comments_blueprint = Blueprint('comments_controller',
+ '__comments_controller__')
+
+
+@comments_blueprint.post('/<post>/comments/')
+def create(post):
+ breakpoint()
+ print(request.form)
diff --git a/src/controllers/dashboard_controller.py b/src/controllers/dashboard_controller.py
index 888e388..bef7441 100644
--- a/src/controllers/dashboard_controller.py
+++ b/src/controllers/dashboard_controller.py
@@ -1,6 +1,8 @@
from flask import Blueprint
-from src.controllers import dashboard_blueprint
-from src.database.models.blog import Blog
+from src.database.models import Blog
+
+dashboard_blueprint = Blueprint('dashboard_controller',
+ '__dashboard_controller__')
@dashboard_blueprint.get('/dashboard')
def index():