Merge pull request #119 from ZeusWPI/feature/add_location_name_to_browser_title
add location name to browser title
This commit is contained in:
commit
2314ec0e3b
3 changed files with 15 additions and 10 deletions
|
@ -1,9 +1,9 @@
|
||||||
from models import User, Location, Order, OrderItem, Product
|
from sqlalchemy.sql import desc, func
|
||||||
from sqlalchemy.sql import func, desc
|
|
||||||
|
from models import Location, Order, OrderItem, Product, User
|
||||||
|
|
||||||
|
|
||||||
class FatModel:
|
class FatModel:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def all(cls):
|
def all(cls):
|
||||||
return cls.query.all()
|
return cls.query.all()
|
||||||
|
@ -13,7 +13,8 @@ class FatModel:
|
||||||
return cls.query.count()
|
return cls.query.count()
|
||||||
|
|
||||||
|
|
||||||
class FatLocation(Location, FatModel): pass
|
class FatLocation(Location, FatModel):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FatOrder(Order, FatModel):
|
class FatOrder(Order, FatModel):
|
||||||
|
@ -30,14 +31,15 @@ class FatOrder(Order, FatModel):
|
||||||
with_entities(Order.id, func.count(OrderItem.user_id).label('total'))
|
with_entities(Order.id, func.count(OrderItem.user_id).label('total'))
|
||||||
|
|
||||||
|
|
||||||
class FatUser(User, FatModel): pass
|
class FatUser(User, FatModel):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FatOrderItem(OrderItem, FatModel): pass
|
class FatOrderItem(OrderItem, FatModel):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FatProduct(Product, FatModel):
|
class FatProduct(Product, FatModel):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def top4(cls):
|
def top4(cls):
|
||||||
top4 = OrderItem.query\
|
top4 = OrderItem.query\
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Haldis - {{ active_page|capitalize }}
|
Haldis - {{ active_page|capitalize }}
|
||||||
|
{% if title %}
|
||||||
|
- {{ title }}
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
|
|
|
@ -39,7 +39,7 @@ def location(id):
|
||||||
loc = Location.query.filter(Location.id == id).first()
|
loc = Location.query.filter(Location.id == id).first()
|
||||||
if loc is None:
|
if loc is None:
|
||||||
abort(404)
|
abort(404)
|
||||||
return render_template('location.html', location=loc)
|
return render_template('location.html', location=loc, title=loc.name)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/about/')
|
@app.route('/about/')
|
||||||
|
|
Loading…
Reference in a new issue