Skip to content

Commit

Permalink
print voucher code on raffle ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
tobru committed Sep 12, 2024
1 parent 574ad1b commit cdb6981
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion contactform/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ def index():
)

if config.PRINT_RAFFLE_TICKET:
print_raffle(form=form, config=config, printer_config=printer_config)
print_raffle(
form=form,
voucher_code=voucher_code,
config=config,
printer_config=printer_config,
)

flash("Thanks for submitting", "success")
return redirect(url_for("index"))
Expand Down
10 changes: 7 additions & 3 deletions contactform/label_raffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from brother_ql.backends.network import BrotherQLBackendNetwork


def print_raffle(form, config, printer_config):
def print_raffle(form, voucher_code, config, printer_config):
label_filename = "label_raffle.png"

label_css = """
Expand All @@ -26,14 +26,18 @@ def print_raffle(form, config, printer_config):
h1 {
font-size: 70px;
}
p {
.big {
font-size: 35px;
}
.small {
font-size: 25px;
}
"""
label_html = f"""\
<div>
<h1>{form.name.data}</h1>
<p>{config.LABEL_HEADER}</p>
<p class="big">{config.LABEL_HEADER}</p>
<p class="small">{voucher_code}</p>
</div>
"""

Expand Down

0 comments on commit cdb6981

Please sign in to comment.