Changed urls to all use 'url_for' syntax
This commit is contained in:
parent
f254c011b6
commit
7ebeb10cda
@ -1,21 +1,17 @@
|
|||||||
""" The user controller to manage all of the stats related endpoints
|
""" The user controller to manage all of the stats related endpoints
|
||||||
in the web app
|
in the web app
|
||||||
"""
|
"""
|
||||||
import json
|
|
||||||
import random
|
|
||||||
from flask import Blueprint
|
from flask import Blueprint
|
||||||
|
|
||||||
from flask import render_template, redirect, request, session, flash
|
from flask import render_template, request
|
||||||
from controllers.database.stats import StatsController
|
from controllers.database.stats import StatsController
|
||||||
from models.stats import Stats
|
|
||||||
from models.users.user import User
|
|
||||||
|
|
||||||
# Blueprint to append user endpoints to
|
# Blueprint to append user endpoints to
|
||||||
blueprint = Blueprint("stats", __name__, url_prefix='/stats')
|
blueprint = Blueprint("stats", __name__, url_prefix='/stats')
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/')
|
@blueprint.route('/')
|
||||||
def stats_index():
|
def index():
|
||||||
""" Main page to view all of the statistics for the site """
|
""" Main page to view all of the statistics for the site """
|
||||||
db = StatsController()
|
db = StatsController()
|
||||||
data = db.read()
|
data = db.read()
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/"><img src="{{url_for('static', filename='assets/img/wmgzon.bmp')}}" id="logo" class="not-required" alt="WMGZON Logo"></a>
|
<a href="{{url_for('main.index')}}"><img src="{{url_for('static', filename='assets/img/wmgzon.bmp')}}" id="logo" class="not-required" alt="WMGZON Logo"></a>
|
||||||
<form action="" method="get">
|
<form action="" method="get">
|
||||||
<input type="text" name="search" placeholder="Find your favourite products" class="search-bar">
|
<input type="text" name="search" placeholder="Find your favourite products" class="search-bar">
|
||||||
<input type="submit" class="search-button">
|
<input type="submit" class="search-button">
|
||||||
</form>
|
</form>
|
||||||
<div class="vert-align">
|
<div class="vert-align">
|
||||||
<a href="/"><img src="{{url_for('static', filename='assets/img/cart.bmp')}}" id="cart" alt="Shopping Cart"></a>
|
<a href="{{url_for('main.index')}}"><img src="{{url_for('static', filename='assets/img/cart.bmp')}}" id="cart" alt="Shopping Cart"></a>
|
||||||
{% if user != None: %}
|
{% if user != None: %}
|
||||||
<a href="/logout">Welcome, {{ user.username }}</a>
|
<a href="{{url_for('main.users.logout')}}">Welcome, {{ user.username }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="/login">Login/Signup</a>
|
<a href="{{url_for('main.users.display_login')}}">Login/Signup</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@ -19,9 +19,9 @@
|
|||||||
{% if user != None and user.role == "Seller" %}
|
{% if user != None and user.role == "Seller" %}
|
||||||
<div class="categories">
|
<div class="categories">
|
||||||
{# List all available seller tools #}
|
{# List all available seller tools #}
|
||||||
<a href="/products/add" class="category">Create Products</a>
|
<a href="{{url_for('main.products.display_add_product')}}" class="category">Create Products</a>
|
||||||
<a href="/products/ownproducts" class="category">View My Products</a>
|
<a href="{{url_for('main.products.display_own_products')}}" class="category">View My Products</a>
|
||||||
<a href="/products/stats" class="category">View Seller Stats</a>
|
<a href="{{url_for('main.stats.index')}}" class="category">View Seller Stats</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@ -29,9 +29,9 @@
|
|||||||
{# List all categories and ensure the selected one is highlighted #}
|
{# List all categories and ensure the selected one is highlighted #}
|
||||||
{% for c in categories %}
|
{% for c in categories %}
|
||||||
{% if category == c.name %}
|
{% if category == c.name %}
|
||||||
<a style="color: cyan" href="/products/{{c.name}}" class="category">{{c.name}}</a>
|
<a style="color: cyan" href="{{url_for('main.products.category', category=c.name)}}" class="category">{{c.name}}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="/products/{{c.name}}" class="category">{{c.name}}</a>
|
<a href="{{url_for('main.products.category', category=c.name)}}" class="category">{{c.name}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,6 +17,6 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div id="create-account-wrap">
|
<div id="create-account-wrap">
|
||||||
<p>Not a member? <a href="signup">Create Account</a><p>
|
<p>Not a member? <a href="{{url_for('main.users.display_signup')}}">Create Account</a><p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,6 +31,6 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div id="create-account-wrap">
|
<div id="create-account-wrap">
|
||||||
<p>Want to view all of your products? <a href="">Click Here</a><p>
|
<p>Want to view all of your products? <a href="{{url_for('main.products.display_own_products')}}">Click Here</a><p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,6 +28,6 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div id="create-account-wrap">
|
<div id="create-account-wrap">
|
||||||
<p>Already have an account? <a href="login">Login</a><p>
|
<p>Already have an account? <a href="{{url_for('main.users.login')}}">Login</a><p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -43,15 +43,6 @@
|
|||||||
<div class="product-container">
|
<div class="product-container">
|
||||||
{% if data != None %}
|
{% if data != None %}
|
||||||
{% for stat in data %}
|
{% for stat in data %}
|
||||||
<a href="/stats/product/{{stat.productID}}" class="product product-link">
|
|
||||||
<div class="product-title">{{stat.userID}}</div>
|
|
||||||
<div class="product-content-container">
|
|
||||||
<div class="product-details">
|
|
||||||
<div class="product-price">£{{stat.productID}}</div>
|
|
||||||
<div class="product-description hide-overflow ">{{stat.viewDate}}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user