add location name to browser title
This commit is contained in:
parent
2cd5fca66b
commit
02c9abe28c
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 func, desc
|
||||
from sqlalchemy.sql import desc, func
|
||||
|
||||
from models import Location, Order, OrderItem, Product, User
|
||||
|
||||
|
||||
class FatModel:
|
||||
|
||||
@classmethod
|
||||
def all(cls):
|
||||
return cls.query.all()
|
||||
|
@ -13,7 +13,8 @@ class FatModel:
|
|||
return cls.query.count()
|
||||
|
||||
|
||||
class FatLocation(Location, FatModel): pass
|
||||
class FatLocation(Location, FatModel):
|
||||
pass
|
||||
|
||||
|
||||
class FatOrder(Order, FatModel):
|
||||
|
@ -30,14 +31,15 @@ class FatOrder(Order, FatModel):
|
|||
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):
|
||||
|
||||
@classmethod
|
||||
def top4(cls):
|
||||
top4 = OrderItem.query\
|
||||
|
|
|
@ -15,7 +15,10 @@
|
|||
{% set active_page = active_page|default('index') -%}
|
||||
|
||||
{% block title %}
|
||||
Haldis - {{ active_page|capitalize }}
|
||||
Haldis - {{ active_page|capitalize }}
|
||||
{% if title %}
|
||||
- {{ title }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
|
|
|
@ -39,7 +39,7 @@ def location(id):
|
|||
loc = Location.query.filter(Location.id == id).first()
|
||||
if loc is None:
|
||||
abort(404)
|
||||
return render_template('location.html', location=loc)
|
||||
return render_template('location.html', location=loc, title=loc.name)
|
||||
|
||||
|
||||
@app.route('/about/')
|
||||
|
|
Loading…
Reference in a new issue