mirror of
https://github.com/ae-utbm/sith.git
synced 2026-11-20 16:09:54 +00:00
forbid minors from selling alcohol
This commit is contained in:
1 parent
e45b4eb9e0
commit
01112a89aa
3 files changed
+45
-2
No files matched your search
@@ -111,6 +111,17 @@ class CounterClick(
|
||||
return redirect(obj) # Redirect to counter
|
||||
|
||||
self.prices = list(obj.get_prices_for(self.customer))
|
||||
if any(user.age < 18 for user in request.barmen):
|
||||
filtered = [p for p in self.prices if p.product.limit_age < 18]
|
||||
if len(filtered) != len(self.prices):
|
||||
self.prices = filtered
|
||||
messages.warning(
|
||||
request,
|
||||
_(
|
||||
"A minor is barman on this on this device, "
|
||||
"so you cannot currently sell alcohol."
|
||||
),
|
||||
)
|
||||
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
|
||||
Reference in new issue
Block a user