mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Add a file upload type to questions (#534)
* Initial stuff * More features
This commit is contained in:
@@ -198,8 +198,17 @@
|
||||
{% endif %}
|
||||
{% for q in line.questions %}
|
||||
<dt>{{ q.question }}</dt>
|
||||
<dd>{% if q.answer %}{{ q.answer|linebreaksbr }}{% else %}
|
||||
<em>{% trans "not answered" %}</em>{% endif %}</dd>
|
||||
<dd>
|
||||
{% if q.answer %}
|
||||
{% if q.answer.file %}
|
||||
<span class="fa fa-file"></span> {{ q.answer.file_link }}
|
||||
{% else %}
|
||||
{{ q.answer|linebreaksbr }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<em>{% trans "not answered" %}</em>
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endfor %}
|
||||
{% for q in line.additional_fields %}
|
||||
<dt>{{ q.question }}</dt>
|
||||
|
||||
@@ -414,7 +414,14 @@ class QuestionView(EventPermissionRequiredMixin, QuestionMixin, ChartContainingV
|
||||
i = self.request.GET.get("item", "")
|
||||
qs = qs.filter(orderposition__item_id__in=(i,))
|
||||
|
||||
if self.object.type in (Question.TYPE_CHOICE, Question.TYPE_CHOICE_MULTIPLE):
|
||||
if self.object.type == Question.TYPE_FILE:
|
||||
qs = [
|
||||
{
|
||||
'answer': ugettext('File uploaded'),
|
||||
'count': qs.filter(file__isnull=False).count()
|
||||
}
|
||||
]
|
||||
elif self.object.type in (Question.TYPE_CHOICE, Question.TYPE_CHOICE_MULTIPLE):
|
||||
qs = qs.order_by('options').values('options', 'options__answer')\
|
||||
.annotate(count=Count('id')).order_by('-count')
|
||||
for a in qs:
|
||||
|
||||
Reference in New Issue
Block a user