mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Contract columns in event list table
This commit is contained in:
@@ -38,6 +38,31 @@ class EventMixin:
|
|||||||
raise ValidationError({'date_to': _('The end of the event has to be later than its start.')})
|
raise ValidationError({'date_to': _('The end of the event has to be later than its start.')})
|
||||||
super().clean()
|
super().clean()
|
||||||
|
|
||||||
|
def get_short_date_from_display(self, tz=None, show_times=True) -> str:
|
||||||
|
"""
|
||||||
|
Returns a shorter formatted string containing the start date of the event with respect
|
||||||
|
to the current locale and to the ``show_times`` setting.
|
||||||
|
"""
|
||||||
|
tz = tz or pytz.timezone(self.settings.timezone)
|
||||||
|
return _date(
|
||||||
|
self.date_from.astimezone(tz),
|
||||||
|
"SHORT_DATETIME_FORMAT" if self.settings.show_times and show_times else "DATE_FORMAT"
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_short_date_to_display(self, tz=None) -> str:
|
||||||
|
"""
|
||||||
|
Returns a shorter formatted string containing the start date of the event with respect
|
||||||
|
to the current locale and to the ``show_times`` setting. Returns an empty string
|
||||||
|
if ``show_date_to`` is ``False``.
|
||||||
|
"""
|
||||||
|
tz = tz or pytz.timezone(self.settings.timezone)
|
||||||
|
if not self.settings.show_date_to or not self.date_to:
|
||||||
|
return ""
|
||||||
|
return _date(
|
||||||
|
self.date_to.astimezone(tz),
|
||||||
|
"SHORT_DATETIME_FORMAT" if self.settings.show_times else "DATE_FORMAT"
|
||||||
|
)
|
||||||
|
|
||||||
def get_date_from_display(self, tz=None, show_times=True) -> str:
|
def get_date_from_display(self, tz=None, show_times=True) -> str:
|
||||||
"""
|
"""
|
||||||
Returns a formatted string containing the start date of the event with respect
|
Returns a formatted string containing the start date of the event with respect
|
||||||
|
|||||||
@@ -51,11 +51,6 @@
|
|||||||
<th>
|
<th>
|
||||||
{% trans "Event name" %}
|
{% trans "Event name" %}
|
||||||
</th>
|
</th>
|
||||||
<th>
|
|
||||||
{% trans "Short form" %}
|
|
||||||
<a href="?{% url_replace request 'ordering' '-slug' %}"><i class="fa fa-caret-down"></i></a>
|
|
||||||
<a href="?{% url_replace request 'ordering' 'slug' %}"><i class="fa fa-caret-up"></i></a>
|
|
||||||
</th>
|
|
||||||
{% if not hide_orga %}
|
{% if not hide_orga %}
|
||||||
<th>
|
<th>
|
||||||
{% trans "Organizer" %}
|
{% trans "Organizer" %}
|
||||||
@@ -67,8 +62,7 @@
|
|||||||
{% trans "Start date" %}
|
{% trans "Start date" %}
|
||||||
<a href="?{% url_replace request 'ordering' '-date_from' %}"><i class="fa fa-caret-down"></i></a>
|
<a href="?{% url_replace request 'ordering' '-date_from' %}"><i class="fa fa-caret-down"></i></a>
|
||||||
<a href="?{% url_replace request 'ordering' 'date_from' %}"><i class="fa fa-caret-up"></i></a>
|
<a href="?{% url_replace request 'ordering' 'date_from' %}"><i class="fa fa-caret-up"></i></a>
|
||||||
</th>
|
/
|
||||||
<th>
|
|
||||||
{% trans "End date" %}
|
{% trans "End date" %}
|
||||||
<a href="?{% url_replace request 'ordering' '-date_to' %}"><i class="fa fa-caret-down"></i></a>
|
<a href="?{% url_replace request 'ordering' '-date_to' %}"><i class="fa fa-caret-down"></i></a>
|
||||||
<a href="?{% url_replace request 'ordering' 'date_to' %}"><i class="fa fa-caret-up"></i></a>
|
<a href="?{% url_replace request 'ordering' 'date_to' %}"><i class="fa fa-caret-up"></i></a>
|
||||||
@@ -83,26 +77,27 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% for e in events %}
|
{% for e in events %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td class="event-name-col">
|
||||||
<strong><a href="{% url "control:event.index" organizer=e.organizer.slug event=e.slug %}">{{ e.name }}</a></strong>
|
<strong><a href="{% url "control:event.index" organizer=e.organizer.slug event=e.slug %}">{{ e.name }}</a></strong>
|
||||||
{% if e.has_subevents %}
|
{% if e.has_subevents %}
|
||||||
<span class="label label-default">{% trans "Series" %}</span>
|
<span class="label label-default">{% trans "Series" %}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<br><small>{{ e.slug }}</small>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ e.slug }}</td>
|
|
||||||
{% if not hide_orga %}<td>{{ e.organizer }}</td>{% endif %}
|
{% if not hide_orga %}<td>{{ e.organizer }}</td>{% endif %}
|
||||||
<td>
|
<td class="event-date-col">
|
||||||
{% if e.has_subevents %}
|
{% if e.has_subevents %}
|
||||||
{{ e.min_from|default_if_none:"" }}
|
{{ e.min_from|default_if_none:""|date:"SHORT_DATETIME_FORMAT" }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ e.get_date_from_display }}
|
{{ e.get_short_date_from_display }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
{% if e.settings.show_date_to and e.date_to %}
|
||||||
<td>
|
<br> –
|
||||||
{% if e.has_subevents %}
|
{% if e.has_subevents %}
|
||||||
{{ e.max_fromto|default_if_none:e.max_from|default_if_none:e.max_to|default_if_none:"" }}
|
{{ e.max_fromto|default_if_none:e.max_from|default_if_none:e.max_to|default_if_none:""|date:"SHORT_DATETIME_FORMAT" }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ e.get_date_from_display }}
|
{{ e.get_short_date_to_display }}
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
|
|||||||
@@ -399,3 +399,7 @@ body.loading #wrapper {
|
|||||||
.fa.disabled {
|
.fa.disabled {
|
||||||
color: $text-muted;
|
color: $text-muted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.event-name-col {
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user