Skip to content

Commit

Permalink
Added GET variables to prepare add log page
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Kraft committed Jul 8, 2024
1 parent 9b6a895 commit 36c17e7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions odmf/webpage/db_editor/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def index(self, logid=None, error=''):

@expose_for(Level.logger)
@web.method.get
def new(self, siteid=None):
def new(self, siteid=None, type=None, message=None):
with db.session_scope() as session:
log = db.Log(id=db.newid(db.Log, session),
message='<Log Message>', time=datetime.today())
Expand All @@ -44,12 +44,17 @@ def new(self, siteid=None):
log.user = session.get(db.Person, user)
if siteid:
log.site = session.get(db.Site, int(siteid))
if type:
log.type = type
if message:
log.message = message
log.time = datetime.today()
sitelist = session.query(db.Site).order_by(db.sql.asc(db.Site.id))
personlist = session.query(db.Person).order_by(db.Person.can_supervise.desc(), db.Person.surname)
typelist = session.scalars(db.sql.select(db.Log.type).distinct())
return web.render(
'log.html', actuallog=log,
types=session.scalars(db.sql.select(db.Log.type).distinct()),
types=typelist,
sites=sitelist,
persons=personlist
).render()
Expand Down

0 comments on commit 36c17e7

Please sign in to comment.