mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Check-in list CSV: Use check-in list name in filename
This commit is contained in:
28
src/pretix/helpers/filenames.py
Normal file
28
src/pretix/helpers/filenames.py
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# This file is part of pretix (Community Edition).
|
||||
#
|
||||
# Copyright (C) 2014-2020 Raphael Michel and contributors
|
||||
# Copyright (C) 2020-2021 rami.io GmbH and contributors
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
|
||||
# Public License as published by the Free Software Foundation in version 3 of the License.
|
||||
#
|
||||
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
|
||||
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
|
||||
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
|
||||
# this file, see <https://pretix.eu/about/en/license>.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
import re
|
||||
|
||||
from text_unidecode import unidecode
|
||||
|
||||
|
||||
def safe_for_filename(val):
|
||||
return re.sub('[^a-zA-Z0-9-_. ]+', '_', unidecode(val))
|
||||
@@ -62,6 +62,7 @@ from pretix.base.timeframes import (
|
||||
resolve_timeframe_to_datetime_start_inclusive_end_exclusive,
|
||||
)
|
||||
from pretix.control.forms.widgets import Select2
|
||||
from pretix.helpers.filenames import safe_for_filename
|
||||
from pretix.helpers.templatetags.jsonfield import JSONExtract
|
||||
from pretix.plugins.reports.exporters import ReportlabExportMixin
|
||||
|
||||
@@ -435,7 +436,7 @@ class CSVCheckinList(CheckInListMixin, ListExporter):
|
||||
return self._fields
|
||||
|
||||
def iterate_list(self, form_data):
|
||||
cl = self.event.checkin_lists.get(pk=form_data['list'])
|
||||
self.cl = cl = self.event.checkin_lists.get(pk=form_data['list'])
|
||||
|
||||
questions = list(Question.objects.filter(event=self.event, id__in=form_data['questions']))
|
||||
|
||||
@@ -612,7 +613,7 @@ class CSVCheckinList(CheckInListMixin, ListExporter):
|
||||
yield row
|
||||
|
||||
def get_filename(self):
|
||||
return '{}_checkin'.format(self.event.slug)
|
||||
return '{}_checkin_{}'.format(self.event.slug, safe_for_filename(self.cl.name))
|
||||
|
||||
|
||||
class CheckinLogList(ListExporter):
|
||||
|
||||
Reference in New Issue
Block a user