mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
@@ -32,11 +32,8 @@
|
|||||||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations under the License.
|
# License for the specific language governing permissions and limitations under the License.
|
||||||
|
|
||||||
from itertools import chain
|
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.utils.encoding import force_str
|
|
||||||
from django.utils.formats import date_format
|
from django.utils.formats import date_format
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
@@ -168,46 +165,6 @@ class QuestionsForm(BaseQuestionsForm):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class AddOnRadioSelect(forms.RadioSelect):
|
|
||||||
option_template_name = 'pretixpresale/forms/addon_choice_option.html'
|
|
||||||
|
|
||||||
def optgroups(self, name, value, attrs=None):
|
|
||||||
attrs = attrs or {}
|
|
||||||
groups = []
|
|
||||||
has_selected = False
|
|
||||||
for index, (option_value, option_label, option_desc) in enumerate(chain(self.choices)):
|
|
||||||
if option_value is None:
|
|
||||||
option_value = ''
|
|
||||||
if isinstance(option_label, (list, tuple)):
|
|
||||||
raise TypeError('Choice groups are not supported here')
|
|
||||||
group_name = None
|
|
||||||
subgroup = []
|
|
||||||
groups.append((group_name, subgroup, index))
|
|
||||||
|
|
||||||
selected = (
|
|
||||||
force_str(option_value) in value and
|
|
||||||
(has_selected is False or self.allow_multiple_selected)
|
|
||||||
)
|
|
||||||
if selected is True and has_selected is False:
|
|
||||||
has_selected = True
|
|
||||||
attrs['description'] = option_desc
|
|
||||||
subgroup.append(self.create_option(
|
|
||||||
name, option_value, option_label, selected, index,
|
|
||||||
subindex=None, attrs=attrs,
|
|
||||||
))
|
|
||||||
|
|
||||||
return groups
|
|
||||||
|
|
||||||
|
|
||||||
class AddOnVariationField(forms.ChoiceField):
|
|
||||||
def valid_value(self, value):
|
|
||||||
text_value = force_str(value)
|
|
||||||
for k, v, d in self.choices:
|
|
||||||
if value == k or text_value == force_str(k):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
class MembershipForm(forms.Form):
|
class MembershipForm(forms.Form):
|
||||||
required_css_class = 'required'
|
required_css_class = 'required'
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
{% load rich_text %}
|
|
||||||
<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %}>{% include "django/forms/widgets/input.html" %} {{ widget.label }}</label> {% if widget.attrs.description %}<span class="fa fa-info-circle toggle-variation-description" aria-hidden="true"></span>
|
|
||||||
<div class="variation-description addon-variation-description">{{ widget.attrs.description|rich_text }}</div>{% endif %}
|
|
||||||
Reference in New Issue
Block a user