From f2f8828db46291f0ce9aaf280eee7604bc1f484f Mon Sep 17 00:00:00 2001 From: s3lph Date: Mon, 10 Sep 2018 00:12:11 +0200 Subject: [PATCH] Fixed image and price entry on product creation. --- matemat/webserver/pagelets/admin.py | 5 +++-- templates/admin_restricted.html | 6 +++--- templates/moduser.html | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/matemat/webserver/pagelets/admin.py b/matemat/webserver/pagelets/admin.py index 0095b67..7d04afe 100644 --- a/matemat/webserver/pagelets/admin.py +++ b/matemat/webserver/pagelets/admin.py @@ -6,6 +6,7 @@ from io import BytesIO from PIL import Image from matemat.webserver import pagelet, RequestArguments, PageletResponse, RedirectResponse, TemplateResponse +from matemat.util.currency_format import parse_chf from matemat.db import MatematDatabase from matemat.db.primitives import User, ReceiptPreference from matemat.exceptions import DatabaseConsistencyError, HttpException @@ -181,8 +182,8 @@ def handle_admin_change(args: RequestArguments, db: MatematDatabase, config: Dic return # Read the properties from the request arguments name = str(args.name) - price_member = int(str(args.pricemember)) - price_non_member = int(str(args.pricenonmember)) + price_member = parse_chf(str(args.pricemember)) + price_non_member = parse_chf(str(args.pricenonmember)) # Create the user in the database newproduct = db.create_product(name, price_member, price_non_member) # If a new product image was uploaded, process it diff --git a/templates/admin_restricted.html b/templates/admin_restricted.html index 6b85a63..99a205d 100644 --- a/templates/admin_restricted.html +++ b/templates/admin_restricted.html @@ -44,13 +44,13 @@
-
+ CHF
-
+ CHF
-
+
diff --git a/templates/moduser.html b/templates/moduser.html index e40e393..b31b5c3 100644 --- a/templates/moduser.html +++ b/templates/moduser.html @@ -42,7 +42,7 @@