Skip to content

Commit

Permalink
Markupsafe bulletin
Browse files Browse the repository at this point in the history
  • Loading branch information
sondregronas committed Aug 24, 2023
1 parent 7deb398 commit 8cab546
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions BookingSystem/db.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sqlite3
from pathlib import Path

import markupsafe

from __init__ import DATABASE, logger


Expand Down Expand Up @@ -31,10 +33,7 @@ def get(key: str) -> str:
value = con.execute('SELECT value FROM settings WHERE name = ?', (key,)).fetchone()
con.close()

if not value:
return ''

return value[0]
return markupsafe.Markup(value[0]) if value else ''

@staticmethod
def set(key: str, value: str) -> None:
Expand Down
3 changes: 2 additions & 1 deletion BookingSystem/templates/forms/bulletin.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<form id="update-bulletin">
<label for="bulletin_title">Tittel</label>
<input name="bulletin_title" id="bulletin_title" placeholder="Tittel" value="{{ bulletin_title }}" maxlength="50"
<input name="bulletin_title" id="bulletin_title" placeholder="Tittel (Valgfritt)" value="{{ bulletin_title }}"
maxlength="50"
autocomplete="off">
<label for="bulletin">Tekst</label>
<input name="bulletin" id="bulletin" placeholder="Tekst" value="{{ bulletin }}"
Expand Down

0 comments on commit 8cab546

Please sign in to comment.