Initial commit

This commit is contained in:
Andros Fenollosa
2016-09-17 12:21:42 +02:00
parent 3b8b91b76a
commit 7e878f6fe1
22 changed files with 817 additions and 0 deletions

32
src/database.py Normal file
View File

@@ -0,0 +1,32 @@
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.sqlite'
db = SQLAlchemy(app)
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(100), unique=True)
password = db.Column(db.String(32))
def __init__(self, email, password):
self.email = email
self.password = password
def __repr__(self):
return '<User {email}>'.format(email=self.email)
class Note(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(100), unique=True)
text = db.Column(db.Text())
def __init__(self, title, text):
self.title = title
self.text = text
def __repr__(self):
return '<Note {title}>'.format(title=self.title)