flask-contacts/models.py

46 lines
993 B
Python
Raw Normal View History

2017-05-10 18:41:02 +02:00
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///book.sqlite'
#app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://root@localhost/book'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
2017-05-11 18:31:59 +02:00
class Contact(db.Model):
__tablename__ = 't_user'
2017-05-10 18:41:02 +02:00
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(30), nullable=True)
password = db.Column(db.String(30), nullable=True)
password2 = db.Column(db.String(30), nullable=True)
2017-05-10 18:41:02 +02:00
def __repr__(self):
return '<Contacts %r>' % self.name
class User():
id = 1
username = 'admin'
password = 'na'
is_active = True
is_authenticated = True
def get_id(id):
2021-02-28 08:21:28 +00:00
return 1
class Company():
name = ''
city = ''
date = ''
class Trans():
name = ''
date = ''
number = ''
price = ''
class Inquery():
name = ''
date = ''
subject = ''