mode some changes to get it working

This commit is contained in:
Feliciaan De Palmenaer 2015-03-26 22:32:34 +01:00
parent c851ce11ec
commit 4e2780d9be
4 changed files with 12 additions and 9 deletions

3
.gitignore vendored
View file

@ -58,4 +58,5 @@ target/
# ConfigFile
app/config.py
# Do not add db file
*.db

View file

@ -1,9 +1,11 @@
from views import *
from app import app, db
from admin import admin
from login import login_manager
from models import *
from views import *
if __name__ == '__main__':
app.run()
if __name__ == '__main__':
app.run(debug=True)
# app.run(host='0.0.0.0')

View file

@ -6,8 +6,7 @@ class User(db.Model):
username = db.Column(db.String(80), unique=True)
admin = db.Column(db.Boolean)
bias = db.Column(db.Integer)
courrier = db.relationship('Courrier', backref='courrier', lazy='dynamic')
logactions = db.relationship('LogAction', backref='user', lazy='dynamic')
orders = db.relationship('Order', backref='courrier', lazy='dynamic')
def configure(self, username, admin, bias):
self.username = username
@ -51,6 +50,7 @@ class Location(db.Model):
def __repr__(self):
return '%s: %s' % (self.name, self.address)
class Food(db.Model):
id = db.Column(db.Integer, primary_key=True)
location_id = db.Column(db.Integer, db.ForeignKey('location.id'))
@ -65,13 +65,14 @@ class Food(db.Model):
def __repr__(self):
return '%s' % self.name
class Order(db.Model):
id = db.Column(db.Integer, primary_key=True)
courrier_id = db.Column(db.Integer, db.ForeignKey('user.id'))
location_id = db.Column(db.Integer, db.ForeignKey('location.id'))
starttime = db.Column(db.DateTime)
stoptime = db.Column(db.DateTime)
orders = db.relationship('OrdreItem', backref='order', lazy='dynamic')
orders = db.relationship('OrderItem', backref='order', lazy='dynamic')
def configure(self, courrier, location, starttime, stoptime):

View file

@ -15,7 +15,6 @@
<li><a href="{{ url_for('home') }}">Home</a></li>
<li><a href="{{ url_for('stats') }}">Stats</a></li>
<li><a href="{{ url_for('about') }}">About</a></li>
<li><a href="{{ url_for('login') }}">Login</a></li>
</ul>
</nav>
</div>