Merge pull request #49 from ZeusWPI/feat/47/add_telephone_number

Feat/47/add telephone number
This commit is contained in:
Feliciaan De Palmenaer 2015-06-04 22:02:49 +02:00
commit 09c1bd5a19
4 changed files with 31 additions and 1 deletions

View file

@ -24,7 +24,7 @@ class UserAdminModel(ModelBaseView):
class LocationAdminModel(ModelBaseView): class LocationAdminModel(ModelBaseView):
column_searchable_list = ('name', 'address', 'website') column_searchable_list = ('name', 'address', 'website')
inline_models = None inline_models = None
form_columns = ('name', 'address', 'website') form_columns = ('name', 'address', 'website', 'telephone')
admin = Admin(app, name='Haldis', url='/admin', template_mode='bootstrap3') admin = Admin(app, name='Haldis', url='/admin', template_mode='bootstrap3')

View file

@ -0,0 +1,26 @@
"""Add telephone number
Revision ID: 3243c3538fc
Revises: 2d696203e56
Create Date: 2015-06-04 18:39:54.895177
"""
# revision identifiers, used by Alembic.
revision = '3243c3538fc'
down_revision = '2d696203e56'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('location', sa.Column('telephone', sa.String(length=20), nullable=True))
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('location', 'telephone')
### end Alembic commands ###

View file

@ -45,6 +45,7 @@ class Location(db.Model):
name = db.Column(db.String(120), nullable=False) name = db.Column(db.String(120), nullable=False)
address = db.Column(db.String(254)) address = db.Column(db.String(254))
website = db.Column(db.String(120)) website = db.Column(db.String(120))
telephone = db.Column(db.String(20), nullable=True)
products = db.relationship('Product', backref='location', lazy='dynamic') products = db.relationship('Product', backref='location', lazy='dynamic')
orders = db.relationship('Order', backref='location', lazy='dynamic') orders = db.relationship('Order', backref='location', lazy='dynamic')

View file

@ -17,6 +17,9 @@
{% endif %} {% endif %}
<br/> <br/>
location: <a href="{{ order.location.website }}">{{ order.location.name }}</a><br/> location: <a href="{{ order.location.website }}">{{ order.location.name }}</a><br/>
{% if order.location.telephone != None %}
telephone: <a href="tel://{{ order.location.telephone }}">{{ order.location.telephone }}</a><br/>
{% endif %}
<b>status:</b> {% if order.stoptime %}<span class="time">{{ order.stoptime|countdown }}</span>{% else %}open{% endif %}<br/> <b>status:</b> {% if order.stoptime %}<span class="time">{{ order.stoptime|countdown }}</span>{% else %}open{% endif %}<br/>
total price: {{ total_price|euro }} total price: {{ total_price|euro }}
</div> </div>