mirror of
https://github.com/pretix/pretix.git
synced 2026-08-06 10:07:50 +00:00
We don't need the 2-d layout, as it is only a special case of the n-d layout
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
{% extends "tixlcontrol/item/base.html" %}
|
||||
{% load i18n %}
|
||||
{% load bootstrap3 %}
|
||||
{% block inside %}
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
{% for val in properties.1.values.all %}
|
||||
<th>{{ val.value }}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for sub in forms %}
|
||||
<tr>
|
||||
<td>{{ sub.row }}</td>
|
||||
{% for form in sub.forms %}
|
||||
<td>
|
||||
{% bootstrap_field form.active layout='inline' %}
|
||||
{% bootstrap_field form.default_price layout='inline' %}
|
||||
{{ form.default_price.errors }}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="form-group submit-group">
|
||||
<button type="submit" class="btn btn-primary btn-save">
|
||||
{% trans "Save" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
@@ -5,7 +5,9 @@
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
{% for major in forms %}
|
||||
<h3>{{ major.row }}</h3>
|
||||
{% if major.row %}
|
||||
<h3>{{ major.row }}</h3>
|
||||
{% endif %}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -18,7 +20,7 @@
|
||||
<tbody>
|
||||
{% for sub in major.forms %}
|
||||
<tr>
|
||||
<td>{{ sub.row }}</td>
|
||||
<td>{{ sub.row.value }}</td>
|
||||
{% for form in sub.forms %}
|
||||
<td>
|
||||
{% bootstrap_field form.active layout='inline' %}
|
||||
|
||||
@@ -616,34 +616,8 @@ class ItemVariations(ItemDetailMixin, EventPermissionRequiredMixin, TemplateView
|
||||
forms.append(form)
|
||||
forms_flat = forms
|
||||
|
||||
elif self.dimension == 2:
|
||||
# For two-dimensional structures we have a grid of forms
|
||||
# prop1 is the property on the grid's y-axis
|
||||
prop1 = self.properties[0]
|
||||
# prop2 is the property on the grid's x-axis
|
||||
prop2 = self.properties[1]
|
||||
|
||||
# Given a list of variations, this will sort them by their position
|
||||
# on the x-axis
|
||||
sort = lambda v: v[prop2.pk].pk
|
||||
|
||||
for val1 in prop1.values.all():
|
||||
formrow = []
|
||||
# We are now inside a grid row. We iterate over all variations
|
||||
# which belong in this row and create forms for them. In order
|
||||
# to achieve this, we select all variation dictionaries which
|
||||
# have the same value for prop1 as our row does and sort them
|
||||
# by their value for prop2.
|
||||
filtered = [v for v in variations if v[prop1.pk].pk == val1.pk]
|
||||
for variation in sorted(filtered, key=sort):
|
||||
form = self.get_form(variation, data)
|
||||
formrow.append(form)
|
||||
forms_flat.append(form)
|
||||
|
||||
forms.append({'row': val1.value, 'forms': formrow})
|
||||
|
||||
elif self.dimension > 2:
|
||||
# For 3 or more dimensional structures we display a list of grids
|
||||
elif self.dimension >= 2:
|
||||
# For 2 or more dimensional structures we display a list of grids
|
||||
# of forms
|
||||
|
||||
# prop1 is the property on all the grid's y-axes
|
||||
@@ -721,9 +695,7 @@ class ItemVariations(ItemDetailMixin, EventPermissionRequiredMixin, TemplateView
|
||||
return ['tixlcontrol/item/variations_0d.html']
|
||||
elif self.dimension == 1:
|
||||
return ['tixlcontrol/item/variations_1d.html']
|
||||
elif self.dimension == 2:
|
||||
return ['tixlcontrol/item/variations_2d.html']
|
||||
elif self.dimension > 2:
|
||||
elif self.dimension >= 2:
|
||||
return ['tixlcontrol/item/variations_nd.html']
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user