remove distribusi user fields from copied model
This commit is contained in:
parent
12bb82a976
commit
544d3fa8a0
4
.gitignore
vendored
4
.gitignore
vendored
@ -6,9 +6,11 @@
|
|||||||
build/
|
build/
|
||||||
dist/
|
dist/
|
||||||
pip-wheel-metadata/
|
pip-wheel-metadata/
|
||||||
|
*.db
|
||||||
|
instance/*
|
||||||
|
migrations/*
|
||||||
library/data/*.toc
|
library/data/*.toc
|
||||||
library/data/*.csv
|
library/data/*.csv
|
||||||
library/data/*.seg
|
library/data/*.seg
|
||||||
library/data/MAIN_WRITELOCK
|
library/data/MAIN_WRITELOCK
|
||||||
library/files/*.pdf
|
library/files/*.pdf
|
||||||
|
|
||||||
|
@ -4,25 +4,49 @@ import tomllib
|
|||||||
|
|
||||||
import flask_apscheduler
|
import flask_apscheduler
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
from flask_bcrypt import Bcrypt
|
||||||
|
from flask_migrate import Migrate
|
||||||
|
from flask_wtf.csrf import CSRFProtect
|
||||||
|
from flask_login import (
|
||||||
|
LoginManager,
|
||||||
|
)
|
||||||
|
|
||||||
from whoosh.fields import *
|
from whoosh.fields import *
|
||||||
from whoosh.index import create_in
|
from whoosh.index import create_in
|
||||||
from whoosh.qparser import QueryParser
|
from whoosh.qparser import QueryParser
|
||||||
|
|
||||||
from application.csvparser import CsvParser
|
from application.csvparser import CsvParser
|
||||||
|
|
||||||
|
db = SQLAlchemy()
|
||||||
|
migrate = Migrate()
|
||||||
|
bcrypt = Bcrypt()
|
||||||
|
login_manager = LoginManager()
|
||||||
|
|
||||||
SCRIPT_DIR = os.path.dirname(__file__)
|
SCRIPT_DIR = os.path.dirname(__file__)
|
||||||
DATA_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "data"))
|
DATA_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "data"))
|
||||||
|
|
||||||
|
|
||||||
def create_app():
|
def create_app():
|
||||||
settings = settings_from_file()
|
settings = settings_from_file()
|
||||||
|
|
||||||
APP = Flask(__name__, static_folder="static")
|
APP = Flask(__name__, static_folder="static")
|
||||||
APP.config["SECRET_KEY"] = "ty4425hk54a21eee5719b9s9df7sdfklx"
|
APP.config["SECRET_KEY"] = os.urandom(24)
|
||||||
APP.config["UPLOAD_FOLDER"] = "tmpupload"
|
APP.config["UPLOAD_FOLDER"] = "tmpupload"
|
||||||
APP.config["LIBRARY_FILENAME"] = settings["libaryfilename"]
|
|
||||||
APP.config["IMAGE_FOLDER"] = "static/images"
|
APP.config["IMAGE_FOLDER"] = "static/images"
|
||||||
|
|
||||||
|
APP.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///libraryusers.db"
|
||||||
|
APP.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True
|
||||||
|
|
||||||
|
APP.config["LIBRARY_FILENAME"] = settings["libaryfilename"]
|
||||||
APP.config["TITLE"] = settings["title"]
|
APP.config["TITLE"] = settings["title"]
|
||||||
|
|
||||||
|
csrf = CSRFProtect(APP)
|
||||||
|
csrf.init_app(APP)
|
||||||
|
login_manager.init_app(APP)
|
||||||
|
db.init_app(APP)
|
||||||
|
migrate.init_app(APP, db, render_as_batch=True)
|
||||||
|
bcrypt.init_app(APP)
|
||||||
|
|
||||||
scheduler = flask_apscheduler.APScheduler()
|
scheduler = flask_apscheduler.APScheduler()
|
||||||
scheduler.api_enabled = False
|
scheduler.api_enabled = False
|
||||||
scheduler.init_app(APP)
|
scheduler.init_app(APP)
|
||||||
|
@ -13,9 +13,6 @@ class User(UserMixin, db.Model):
|
|||||||
password = db.Column(db.String(300), nullable=False, unique=False)
|
password = db.Column(db.String(300), nullable=False, unique=False)
|
||||||
resethash = db.Column(db.String(300), nullable=True, unique=True)
|
resethash = db.Column(db.String(300), nullable=True, unique=True)
|
||||||
resettime = db.Column(db.DateTime)
|
resettime = db.Column(db.DateTime)
|
||||||
# active = db.Column(db.Boolean, default=False)
|
|
||||||
tutor = db.Column(db.Boolean, default=False)
|
|
||||||
admin = db.Column(db.Boolean, default=False)
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<User %r>" % self.email
|
return "<User %r>" % self.email
|
||||||
|
@ -6,7 +6,7 @@ def deploy():
|
|||||||
"""Run deployment of database."""
|
"""Run deployment of database."""
|
||||||
|
|
||||||
# This model is required for flask_migrate to make the table
|
# This model is required for flask_migrate to make the table
|
||||||
from usermodel import User # noqa: F401
|
from application.models.usermodel import User # noqa: F401
|
||||||
|
|
||||||
app = create_app()
|
app = create_app()
|
||||||
app.app_context().push()
|
app.app_context().push()
|
||||||
|
Loading…
Reference in New Issue
Block a user