mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Fix voucher redemption and event index after c4bf73c
This commit is contained in:
@@ -36,7 +36,8 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<strong>{{ item.name }}</strong>
|
<strong>{{ item.name }}</strong>
|
||||||
{% if item.description %}<p>{{ item.description|localize|rich_text }}</p>{% endif %}
|
{% if item.description %}
|
||||||
|
<p>{{ item.description|localize|rich_text }}</p>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-xs-6 price">
|
<div class="col-md-2 col-xs-6 price">
|
||||||
{% if item.min_price != item.max_price or item.free_price %}
|
{% if item.min_price != item.max_price or item.free_price %}
|
||||||
@@ -65,10 +66,11 @@
|
|||||||
placeholder="0"
|
placeholder="0"
|
||||||
min="{{ var.price|stringformat:"0.2f" }}"
|
min="{{ var.price|stringformat:"0.2f" }}"
|
||||||
name="price_{{ item.id }}_{{ var.id }}"
|
name="price_{{ item.id }}_{{ var.id }}"
|
||||||
step="any" value="{{ var.price|stringformat:"0.2f" }}">
|
step="any"
|
||||||
|
value="{{ var.display_price|stringformat:"0.2f" }}">
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ event.currency }} {{ var.price|floatformat:2 }}
|
{{ event.currency }} {{ var.display_price|floatformat:2 }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if item.tax_rate %}
|
{% if item.tax_rate %}
|
||||||
<small>{% blocktrans trimmed with rate=item.tax_rate %}
|
<small>{% blocktrans trimmed with rate=item.tax_rate %}
|
||||||
@@ -81,7 +83,7 @@
|
|||||||
<label>
|
<label>
|
||||||
{% if max_times > 1 %}
|
{% if max_times > 1 %}
|
||||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||||
max="{{ item.order_max }}" name="variation_{{ item.id }}_{{ var.id }}">
|
max="{{ item.order_max }}" name="variation_{{ item.id }}_{{ var.id }}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="radio" name="_voucher_item"
|
<input type="radio" name="_voucher_item"
|
||||||
{% if options == 1 %}checked="checked"{% endif %}
|
{% if options == 1 %}checked="checked"{% endif %}
|
||||||
@@ -135,7 +137,7 @@
|
|||||||
<label>
|
<label>
|
||||||
{% if max_times > 1 %}
|
{% if max_times > 1 %}
|
||||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||||
max="{{ item.order_max }}" name="item_{{ item.id }}">
|
max="{{ item.order_max }}" name="item_{{ item.id }}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="radio" name="_voucher_item"
|
<input type="radio" name="_voucher_item"
|
||||||
{% if options == 1 %}checked="checked"{% endif %}
|
{% if options == 1 %}checked="checked"{% endif %}
|
||||||
|
|||||||
@@ -195,9 +195,7 @@ class RedeemView(EventViewMixin, TemplateView):
|
|||||||
var.cached_availability = (Quota.AVAILABILITY_OK, 1)
|
var.cached_availability = (Quota.AVAILABILITY_OK, 1)
|
||||||
else:
|
else:
|
||||||
var.cached_availability = list(var.check_quotas())
|
var.cached_availability = list(var.check_quotas())
|
||||||
var.price = self.voucher.calculate_price(
|
var.display_price = self.voucher.calculate_price(var.price)
|
||||||
var.default_price if var.default_price is not None else item.default_price
|
|
||||||
)
|
|
||||||
|
|
||||||
if len(item.available_variations) > 0:
|
if len(item.available_variations) > 0:
|
||||||
item.min_price = min([v.price for v in item.available_variations])
|
item.min_price = min([v.price for v in item.available_variations])
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ from django.views.generic import TemplateView
|
|||||||
|
|
||||||
from pretix.base.models import ItemVariation
|
from pretix.base.models import ItemVariation
|
||||||
from pretix.multidomain.urlreverse import eventreverse
|
from pretix.multidomain.urlreverse import eventreverse
|
||||||
|
|
||||||
from . import CartMixin, EventViewMixin
|
from . import CartMixin, EventViewMixin
|
||||||
|
|
||||||
SessionStore = import_module(settings.SESSION_ENGINE).SessionStore
|
SessionStore = import_module(settings.SESSION_ENGINE).SessionStore
|
||||||
@@ -71,7 +70,6 @@ def get_grouped_items(event):
|
|||||||
if var.cached_availability[1] is not None else sys.maxsize,
|
if var.cached_availability[1] is not None else sys.maxsize,
|
||||||
int(event.settings.max_items_per_order))
|
int(event.settings.max_items_per_order))
|
||||||
display_add_to_cart = display_add_to_cart or var.order_max > 0
|
display_add_to_cart = display_add_to_cart or var.order_max > 0
|
||||||
var.price = var.default_price if var.default_price is not None else item.default_price
|
|
||||||
if len(item.available_variations) > 0:
|
if len(item.available_variations) > 0:
|
||||||
item.min_price = min([v.price for v in item.available_variations])
|
item.min_price = min([v.price for v in item.available_variations])
|
||||||
item.max_price = max([v.price for v in item.available_variations])
|
item.max_price = max([v.price for v in item.available_variations])
|
||||||
@@ -105,7 +103,6 @@ class EventIndex(EventViewMixin, CartMixin, TemplateView):
|
|||||||
|
|
||||||
|
|
||||||
class EventAuth(View):
|
class EventAuth(View):
|
||||||
|
|
||||||
@method_decorator(csrf_exempt)
|
@method_decorator(csrf_exempt)
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user