forked from crunk/distribusi-verse
crunk
3 years ago
5 changed files with 139 additions and 37 deletions
@ -0,0 +1,61 @@ |
|||
from flask import ( |
|||
render_template, |
|||
redirect, |
|||
request, |
|||
flash, |
|||
url_for, |
|||
abort, |
|||
) |
|||
|
|||
from usermodel import User |
|||
from flask_login import current_user |
|||
|
|||
from forms.loginform import LoginForm |
|||
from forms.uploadform import UploadForm |
|||
from forms.distribusiform import DistribusiForm |
|||
from forms.themeform import ThemeForm |
|||
from forms.editorform import EditorForm |
|||
from forms.selectorform import SelectorForm |
|||
|
|||
from statuspengguna.helper import HasDistribusi |
|||
from statuspengguna.helper import DistribusiSelected |
|||
|
|||
from app import db |
|||
|
|||
|
|||
def SelectNewDistribusi(): |
|||
print("make a new distribusi") |
|||
user = User.query.filter_by(email=current_user.email).first() |
|||
try: |
|||
user.currentdistribusi = "new" |
|||
db.session.commit() |
|||
except: |
|||
db.session.rollback() |
|||
selectorform.new.errors.append("Unknown error occured!") |
|||
flash("An error occured !", "danger") |
|||
|
|||
|
|||
def SelectUpdateDistribusi(distribusiname): |
|||
print(f"Update this distribusi {distribusiname}") |
|||
user = User.query.filter_by(email=current_user.email).first() |
|||
try: |
|||
user.currentdistribusi = distribusiname |
|||
db.session.commit() |
|||
except: |
|||
db.session.rollback() |
|||
selectorform.new.errors.append("Unknown error occured!") |
|||
flash("An error occured !", "danger") |
|||
|
|||
|
|||
def DeleteDistribusi(distribusiname): |
|||
print(f"delete this distribusi {distribusiname}") |
|||
|
|||
|
|||
def SelectorVisible(): |
|||
has_distribusi = HasDistribusi() |
|||
distribusi_selected = DistribusiSelected() |
|||
if distribusi_selected: |
|||
return False |
|||
if not has_distribusi: |
|||
return False |
|||
return True |
Loading…
Reference in new issue