mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Add comment field to subevents (Z#23148472) (#4099)
* Add comment field to subevents (Z#23148472) * Review fix
This commit is contained in:
@@ -472,7 +472,8 @@ class SubEventSerializer(I18nAwareModelSerializer):
|
||||
fields = ('id', 'name', 'date_from', 'date_to', 'active', 'date_admission',
|
||||
'presale_start', 'presale_end', 'location', 'geo_lat', 'geo_lon', 'event', 'is_public',
|
||||
'frontpage_text', 'seating_plan', 'item_price_overrides', 'variation_price_overrides',
|
||||
'meta_data', 'seat_category_mapping', 'last_modified', 'best_availability_state')
|
||||
'meta_data', 'seat_category_mapping', 'last_modified', 'best_availability_state',
|
||||
'comment')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
18
src/pretix/base/migrations/0262_subevent_comment.py
Normal file
18
src/pretix/base/migrations/0262_subevent_comment.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 4.2.10 on 2024-04-19 14:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("pretixbase", "0261_userknownloginsource"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="subevent",
|
||||
name="comment",
|
||||
field=models.TextField(null=True),
|
||||
),
|
||||
]
|
||||
@@ -1465,6 +1465,10 @@ class SubEvent(EventMixin, LoggedModel):
|
||||
|
||||
items = models.ManyToManyField('Item', through='SubEventItem')
|
||||
variations = models.ManyToManyField('ItemVariation', through='SubEventItemVariation')
|
||||
comment = models.TextField(
|
||||
verbose_name=_("Internal comment"),
|
||||
null=True, blank=True
|
||||
)
|
||||
|
||||
last_modified = models.DateTimeField(
|
||||
auto_now=True, db_index=True
|
||||
|
||||
@@ -1231,7 +1231,7 @@ class SubEventFilterForm(FilterForm):
|
||||
if fdata.get('query'):
|
||||
query = fdata.get('query')
|
||||
qs = qs.filter(
|
||||
Q(name__icontains=i18ncomp(query)) | Q(location__icontains=query)
|
||||
Q(name__icontains=i18ncomp(query)) | Q(location__icontains=query) | Q(comment__icontains=query)
|
||||
)
|
||||
|
||||
if fdata.get('date_until'):
|
||||
|
||||
@@ -68,6 +68,7 @@ class SubEventForm(I18nModelForm):
|
||||
'presale_end',
|
||||
'location',
|
||||
'frontpage_text',
|
||||
'comment',
|
||||
'geo_lat',
|
||||
'geo_lon',
|
||||
]
|
||||
@@ -136,7 +137,7 @@ class SubEventBulkEditForm(I18nModelForm):
|
||||
self.fields[k].widget.attrs['placeholder'] = ''
|
||||
self.fields[k].one_required = False
|
||||
|
||||
for k in ('geo_lat', 'geo_lon'):
|
||||
for k in ('geo_lat', 'geo_lon', 'comment'):
|
||||
# scalar fields
|
||||
if k in self.mixed_values:
|
||||
self.fields[k].widget.attrs['placeholder'] = '[{}]'.format(_('Selection contains various values'))
|
||||
@@ -166,6 +167,7 @@ class SubEventBulkEditForm(I18nModelForm):
|
||||
'name',
|
||||
'location',
|
||||
'frontpage_text',
|
||||
'comment',
|
||||
'geo_lat',
|
||||
'geo_lon',
|
||||
'is_public',
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
</div>
|
||||
{% bootstrap_field form.frontpage_text layout="bulkedit" %}
|
||||
{% bootstrap_field form.is_public layout="bulkedit" %}
|
||||
{% bootstrap_field form.comment layout="bulkedit" %}
|
||||
{% if meta_forms %}
|
||||
<div class="form-group metadata-group">
|
||||
<label class="col-md-3 control-label">{% trans "Meta data" %}</label>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
{% bootstrap_field form.date_admission layout="control" %}
|
||||
{% bootstrap_field form.frontpage_text layout="control" %}
|
||||
{% bootstrap_field form.is_public layout="control" %}
|
||||
{% bootstrap_field form.comment layout="control" %}
|
||||
{% if meta_forms %}
|
||||
<div class="form-group metadata-group">
|
||||
<label class="col-md-3 control-label">{% trans "Meta data" %}</label>
|
||||
|
||||
@@ -138,6 +138,9 @@
|
||||
<small class="text-muted">· {{ k }}: {{ v }}</small>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if s.comment %}
|
||||
<br>{{ s.comment|linebreaksbr }}
|
||||
{% endif %}
|
||||
</small>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@@ -1440,6 +1440,7 @@ class SubEventBulkEdit(SubEventQueryMixin, EventPermissionRequiredMixin, FormVie
|
||||
'name',
|
||||
'location',
|
||||
'frontpage_text',
|
||||
'comment',
|
||||
'geo_lat',
|
||||
'geo_lon',
|
||||
'is_public',
|
||||
|
||||
Reference in New Issue
Block a user