working version alpha

This commit is contained in:
crunk 2024-04-21 22:09:44 +02:00
parent cefdc8cd11
commit 963b33f170
4 changed files with 6 additions and 15 deletions

View File

@ -9,14 +9,10 @@ class Distribusis(db.Model):
id = db.Column(db.Integer, primary_key=True)
distribusiname = db.Column(db.String(300), nullable=False, unique=True)
userid = db.Column(db.Integer, db.ForeignKey("users.id"))
term = db.Column(db.String(5), nullable=False, unique=False)
category = db.Column(db.String(500), nullable=True, unique=False)
# Academic year eg:2020-2021, so no need for a Datetime object
year = db.Column(db.String(9), nullable=True, unique=False)
tags = db.Column(db.String(500), nullable=True, unique=False)
publictheme = db.Column(db.String(300), unique=True, nullable=True)
visible = db.Column(db.Boolean, default=False)
def __repr__(self):

View File

@ -59,7 +59,6 @@ def index():
distribusisindex[distribusi.distribusiname] = singledistribusi
years = uploadform.year.choices
categories = uploadform.category.choices
adminuser = isadminuser()
template = render_template(
"index.html",
@ -100,7 +99,6 @@ def publicthemes(path):
distribusi = Distribusis.query.filter_by(distribusiname=path).first()
publicthemefolder = f"publicthemes/{distribusi.distribusiname}/"
cssfile = f"{publicthemefolder}/{distribusi.publictheme}.css"
print(cssfile)
return send_from_directory("themes", cssfile, as_attachment=True)

View File

@ -24,9 +24,8 @@ function filterSelection(c, name, id) {
}
function resetDropDownButtons(){
document.getElementById("Academicyear").innerText = "Academic year";
document.getElementById("Term").innerText = "Term";
document.getElementById("Course").innerText = "Course";
document.getElementById("Year").innerText = "Year";
document.getElementById("Category").innerText = "Category";
allactivebuttons = document.getElementsByClassName("activebtn");
for(var i = 0;allactivebuttons.length; i++) {
removeClass(allactivebuttons[i], "activebtn");

View File

@ -22,9 +22,8 @@ def UploadNewDistribusi(uploadfolder):
newdistribusi = Distribusis(
distribusiname=uploadform.sitename.data,
userid=user.id,
term=uploadform.term.data,
course=uploadform.course.data,
year=uploadform.academicyear.data,
category=uploadform.category.data,
year=uploadform.year.data,
tags=uploadform.tags.data,
)
user.currentdistribusi = uploadform.sitename.data
@ -66,9 +65,8 @@ def UploadUpdatedFiles(uploadfolder):
distribusi = Distribusis.query.filter_by(
distribusiname=current_distribusi
).first()
distribusi.term = uploadform.term.data
distribusi.course = uploadform.course.data
distribusi.year = uploadform.academicyear.data
distribusi.category = uploadform.category.data
distribusi.year = uploadform.year.data
distribusi.tags = uploadform.tags.data
distribusi.visible = False
db.session.commit()