Commit fc1a4d3b authored by Mathis Dedial's avatar Mathis Dedial
Browse files

Add comments / docs

parent f37dbd4b
# Burger-Tool (AMIV Anniversary 125 years)
'''
Entry point. Calls the app's run() method
'''
from app import app
app.run()
'''Contains model definitions for SQLAlchemy ORM'''
'''
Contains model definitions for SQLAlchemy ORM
'''
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Burger(db.Model):
'''
Represents a Burger created by a user.
Each user can create at most one burger.
'''
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(length=128), unique=True, nullable=False)
description = db.Column(db.Text, unique=False, nullable=False)
......@@ -18,6 +25,12 @@ class Burger(db.Model):
class Vote(db.Model):
'''
Represents a single vote by a single user.
One user can vote as many times as he / she wishes. However, a user can at most give one vote
to a given burger.
'''
id = db.Column(db.Integer, primary_key=True)
nethz = db.Column(db.String(64), unique=False, nullable=False)
burger_id = db.Column(db.Integer, db.ForeignKey('burger.id'), nullable=False)
......
'''Contains all views'''
'''
Contains all views
'''
from app import app
@app.route('/')
......
'''Script to recreate the database schema according to models.py'''
'''
Helper script to recreate the database schema after changes have been made to models.py
'''
import app
# Fix for a weird bug which occurs when using db.init_app(app)
app.db.app = app.app
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment