2017-05-10 18:41:02 +02:00
|
|
|
from flask import Flask
|
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
|
|
|
|
app = Flask(__name__)
|
2018-05-01 14:18:23 +02:00
|
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://bgcmtrdgusuwik:05060b67183fb8ba7ddb937aaec3f6a20617b3bbd547ce89a19eceb760f6fa4b@ec2-54-217-217-142.eu-west-1.compute.amazonaws.com:5432/d2po2asdglml7g'
|
2017-05-10 18:41:02 +02:00
|
|
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
|
|
|
db = SQLAlchemy(app)
|
|
|
|
|
2017-05-11 18:31:59 +02:00
|
|
|
class Contact(db.Model):
|
|
|
|
|
|
|
|
|
|
|
|
__tablename__ = 'contacts'
|
|
|
|
|
2017-05-10 18:41:02 +02:00
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
name = db.Column(db.String(80), nullable=False)
|
|
|
|
surname = db.Column(db.String(100), nullable=True)
|
|
|
|
email = db.Column(db.String(200), nullable=True, unique=True)
|
|
|
|
phone = db.Column(db.String(20), nullable=True, unique=False)
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return '<Contacts %r>' % self.name
|