From 48b6e6f211ecf84aa088b7f3c470bf87438cd903 Mon Sep 17 00:00:00 2001 From: crunk Date: Sun, 28 Apr 2024 15:34:29 +0200 Subject: [PATCH] snake case model files --- verse/adminpage.py | 4 ++-- verse/admintool.py | 4 ++-- verse/deploydb.py | 4 ++-- verse/distribusikan/distribusiselector.py | 4 ++-- verse/distribusikan/distribusisinfo.py | 4 ++-- verse/distribusikan/distribusiworkflow.py | 4 ++-- verse/distribusikan/editor.py | 2 +- verse/distribusikan/upload.py | 4 ++-- verse/models/distribusi_file_model.py | 17 +++++++++++++++++ .../{distribusimodel.py => distribusi_model.py} | 0 verse/models/{usermodel.py => user_model.py} | 0 verse/start.py | 4 ++-- verse/statuspengguna/forgotpassword.py | 2 +- verse/statuspengguna/helper.py | 4 ++-- verse/statuspengguna/loginuser.py | 2 +- verse/statuspengguna/registeruser.py | 2 +- verse/statuspengguna/resetpassword.py | 2 +- 17 files changed, 40 insertions(+), 23 deletions(-) rename verse/models/{distribusimodel.py => distribusi_model.py} (100%) rename verse/models/{usermodel.py => user_model.py} (100%) diff --git a/verse/adminpage.py b/verse/adminpage.py index b158900..4d78d26 100644 --- a/verse/adminpage.py +++ b/verse/adminpage.py @@ -13,8 +13,8 @@ from app import db from distribusikan.distribusisinfo import DistribusisInfo from forms.admindistribusiform import AdminDistribusiForm from forms.adminuserform import AdminUserForm -from models.distribusimodel import Distribusis -from models.usermodel import User +from models.distribusi_model import Distribusis +from models.user_model import User def AdminPage(): diff --git a/verse/admintool.py b/verse/admintool.py index 9d392ab..c8ddac3 100644 --- a/verse/admintool.py +++ b/verse/admintool.py @@ -8,8 +8,8 @@ from sqlalchemy.exc import ( ) from app import create_app, db -from models.distribusimodel import Distribusis # noqa: F401 -from models.usermodel import User # noqa: F401 +from models.distribusi_model import Distribusis # noqa: F401 +from models.user_model import User # noqa: F401 def admintool(): diff --git a/verse/deploydb.py b/verse/deploydb.py index fe3186d..9a33cdc 100644 --- a/verse/deploydb.py +++ b/verse/deploydb.py @@ -3,10 +3,10 @@ def deploy(): from flask_migrate import init, migrate, stamp, upgrade from app import create_app, db - from models.distribusimodel import Distribusis # noqa: F401 + from models.distribusi_model import Distribusis # noqa: F401 # This model is required for flask_migrate to make the table - from models.usermodel import User # noqa: F401 + from models.user_model import User # noqa: F401 app = create_app() app.app_context().push() diff --git a/verse/distribusikan/distribusiselector.py b/verse/distribusikan/distribusiselector.py index 58d2f1b..ccc5770 100644 --- a/verse/distribusikan/distribusiselector.py +++ b/verse/distribusikan/distribusiselector.py @@ -17,8 +17,8 @@ from forms.publicthemeform import PublicThemeForm from forms.selectorform import SelectorForm from forms.themeform import ThemeForm from forms.uploadform import UploadForm -from models.distribusimodel import Distribusis -from models.usermodel import User +from models.distribusi_model import Distribusis +from models.user_model import User # UserPengguna from statuspengguna.helper import UserHelper diff --git a/verse/distribusikan/distribusisinfo.py b/verse/distribusikan/distribusisinfo.py index 5a47d5f..19ef284 100644 --- a/verse/distribusikan/distribusisinfo.py +++ b/verse/distribusikan/distribusisinfo.py @@ -1,7 +1,7 @@ from flask_login import current_user -from models.distribusimodel import Distribusis -from models.usermodel import User +from models.distribusi_model import Distribusis +from models.user_model import User class DistribusisInfo: diff --git a/verse/distribusikan/distribusiworkflow.py b/verse/distribusikan/distribusiworkflow.py index 82270aa..4e3a376 100644 --- a/verse/distribusikan/distribusiworkflow.py +++ b/verse/distribusikan/distribusiworkflow.py @@ -24,8 +24,8 @@ from forms.themeform import ThemeForm # Forms! from forms.uploadform import UploadForm -from models.distribusimodel import Distribusis -from models.usermodel import User +from models.distribusi_model import Distribusis +from models.user_model import User # UserPengguna from statuspengguna.helper import UserHelper diff --git a/verse/distribusikan/editor.py b/verse/distribusikan/editor.py index 794d879..88e63c2 100644 --- a/verse/distribusikan/editor.py +++ b/verse/distribusikan/editor.py @@ -20,7 +20,7 @@ from forms.publicthemeform import PublicThemeForm from forms.selectorform import SelectorForm from forms.themeform import ThemeForm from forms.uploadform import UploadForm -from models.distribusimodel import Distribusis +from models.distribusi_model import Distribusis from statuspengguna.helper import UserHelper diff --git a/verse/distribusikan/upload.py b/verse/distribusikan/upload.py index f2be184..83110b5 100644 --- a/verse/distribusikan/upload.py +++ b/verse/distribusikan/upload.py @@ -14,8 +14,8 @@ from sqlalchemy.exc import ( from app import db from distribusikan.distribusiselector import SelectCurrentDistribusi from forms.uploadform import UploadForm -from models.distribusimodel import Distribusis -from models.usermodel import User +from models.distribusi_model import Distribusis +from models.user_model import User from statuspengguna.helper import UserHelper diff --git a/verse/models/distribusi_file_model.py b/verse/models/distribusi_file_model.py index e69de29..503f7bb 100644 --- a/verse/models/distribusi_file_model.py +++ b/verse/models/distribusi_file_model.py @@ -0,0 +1,17 @@ +from app import db + + +class DistribusiFiles(db.Model): + """Distribusi file model class for a single file in a distribusi""" + + __tablename__ = "distribusi_files" + + id = db.Column(db.Integer, primary_key=True) + type = db.Column(db.String(300), nullable=False, unique=True) + distribusi = db.Column(db.Integer, db.ForeignKey("distribusis.id")) + path = db.Column(db.String(4096), nullable=True, unique=False) + description = db.Column(db.String(9), nullable=True, unique=False) + tags = db.Column(db.String(500), nullable=True, unique=False) + + def __repr__(self): + return "" % self.distribusiname diff --git a/verse/models/distribusimodel.py b/verse/models/distribusi_model.py similarity index 100% rename from verse/models/distribusimodel.py rename to verse/models/distribusi_model.py diff --git a/verse/models/usermodel.py b/verse/models/user_model.py similarity index 100% rename from verse/models/usermodel.py rename to verse/models/user_model.py diff --git a/verse/start.py b/verse/start.py index f2e9fc8..5cbe8c5 100644 --- a/verse/start.py +++ b/verse/start.py @@ -22,8 +22,8 @@ from distribusikan.distribusisinfo import DistribusisInfo # Use upload form to populate filters from forms.uploadform import UploadForm -from models.distribusimodel import Distribusis -from models.usermodel import User +from models.distribusi_model import Distribusis +from models.user_model import User from statuspengguna.forgotpassword import forgot_password from statuspengguna.helper import UserHelper from statuspengguna.loginuser import login_section diff --git a/verse/statuspengguna/forgotpassword.py b/verse/statuspengguna/forgotpassword.py index 676a5c8..dbb8049 100644 --- a/verse/statuspengguna/forgotpassword.py +++ b/verse/statuspengguna/forgotpassword.py @@ -12,7 +12,7 @@ from sqlalchemy.exc import ( from app import db, get_app from forms.forgotpasswordform import ForgotPasswordForm -from models.usermodel import User +from models.user_model import User mail = Mail(get_app()) forgot_password = Blueprint( diff --git a/verse/statuspengguna/helper.py b/verse/statuspengguna/helper.py index 022326e..a8b26bd 100644 --- a/verse/statuspengguna/helper.py +++ b/verse/statuspengguna/helper.py @@ -11,8 +11,8 @@ from sqlalchemy.exc import ( from app import db from distribusikan.distribusisinfo import DistribusisInfo -from models.distribusimodel import Distribusis -from models.usermodel import User +from models.distribusi_model import Distribusis +from models.user_model import User class UserHelper: diff --git a/verse/statuspengguna/loginuser.py b/verse/statuspengguna/loginuser.py index cab7403..db08cac 100644 --- a/verse/statuspengguna/loginuser.py +++ b/verse/statuspengguna/loginuser.py @@ -13,7 +13,7 @@ from flask_bcrypt import check_password_hash from flask_login import login_user from forms.loginform import LoginForm -from models.usermodel import User +from models.user_model import User login_section = Blueprint( "login", diff --git a/verse/statuspengguna/registeruser.py b/verse/statuspengguna/registeruser.py index 7a7fe46..e97f1ee 100644 --- a/verse/statuspengguna/registeruser.py +++ b/verse/statuspengguna/registeruser.py @@ -12,7 +12,7 @@ from werkzeug.routing import BuildError from app import db from forms.registerform import RegisterForm -from models.usermodel import User +from models.user_model import User register_user = Blueprint( "register", diff --git a/verse/statuspengguna/resetpassword.py b/verse/statuspengguna/resetpassword.py index fea2ae9..a75f86e 100644 --- a/verse/statuspengguna/resetpassword.py +++ b/verse/statuspengguna/resetpassword.py @@ -14,7 +14,7 @@ from werkzeug.routing import BuildError from app import db from forms.resetpasswordform import ResetPasswordForm -from models.usermodel import User +from models.user_model import User from statuspengguna import statuspengguna reset_password = Blueprint(