distribusi-verse: medium-tech web app content management system for the web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from flask_login import current_user
|
|
|
|
|
|
|
|
from usermodel import User
|
|
|
|
from distribusimodel import Distribusis
|
|
|
|
|
|
|
|
|
|
|
|
class DistribusisInfo:
|
|
|
|
def userdistribusis():
|
|
|
|
distribusinames = []
|
|
|
|
user = User.query.filter_by(email=current_user.email).first()
|
|
|
|
for distribusi in Distribusis.query.filter_by(userid=user.id).all():
|
|
|
|
distribusinames.append(distribusi.distribusiname)
|
|
|
|
return distribusinames
|
|
|
|
|
|
|
|
def publicthemes():
|
|
|
|
publicthemes = []
|
|
|
|
distribusis = Distribusis.query.filter(
|
|
|
|
Distribusis.publictheme.isnot(None)
|
|
|
|
).all()
|
|
|
|
for distribusi in distribusis:
|
|
|
|
publictheme = (
|
|
|
|
f"{distribusi.distribusiname}/{distribusi.publictheme}",
|
|
|
|
f"{distribusi.publictheme} used in {distribusi.distribusiname}",
|
|
|
|
)
|
|
|
|
publicthemes.append(publictheme)
|
|
|
|
return publicthemes
|