REFACTOR: Changes all raw url's to url_fors

This commit is contained in:
2024-02-13 23:15:32 +00:00
parent 3dc7a1f861
commit 82f1eed554
12 changed files with 64 additions and 70 deletions

View File

@@ -3,7 +3,7 @@
"""
from flask import Blueprint
from flask import render_template, request, flash, session, redirect
from flask import render_template, request, flash, session, redirect, url_for
from controllers.database.stats import StatsController
from controllers.database.product import ProductController
from controllers.database.category import CategoryController
@@ -31,7 +31,7 @@ def view_product_stats(id: int):
# Check user is seller
if not is_role("Seller"):
flash("You must be logged in as a seller to view this page!", "error")
return redirect("/")
return redirect(url_for('main.index'))
db = ProductController()
product = db.read_id(id)
@@ -39,7 +39,7 @@ def view_product_stats(id: int):
# Check user owns this product
if product is None or product.sellerID is not session.get("user_id"):
flash("This product does not belong to you!", "error")
return redirect("/products/ownproducts")
return redirect(url_for('main.products.display_own'))
db = StatsController()