REFACTOR: Changes all raw url's to url_fors
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user