forked from CGM_Public/pretix_original
Display a timeline on the dashboard (#1290)
* Timeline data model * Display timeline * … * More events * Plugin support * Fix docs typo
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
{% load i18n %}
|
||||
<div class="panel panel-default items">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
{% trans "Your timeline" %}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body timeline">
|
||||
{% regroup timeline by date as tl_list %}
|
||||
{% for day in tl_list %}
|
||||
<div class="row {% if day.grouper < today %}text-muted{% endif %}">
|
||||
<div class="col-date">
|
||||
<strong>{{ day.grouper|date:"SHORT_DATE_FORMAT" }}</strong>
|
||||
</div>
|
||||
<div class="col-event">
|
||||
{% for e in day.list %}
|
||||
<strong class="">{{ e.time|date:"TIME_FORMAT" }}</strong>
|
||||
|
||||
<span class="{% if e.time < nearly_now %}text-muted{% endif %}">
|
||||
{{ e.entry.description }}
|
||||
</span>
|
||||
{% if e.entry.edit_url %}
|
||||
|
||||
<a href="{{ e.entry.edit_url }}" class="text-muted">
|
||||
<span class="fa fa-edit"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if forloop.revcounter > 1 %}
|
||||
<br/>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -90,6 +90,9 @@
|
||||
{% include "pretixcontrol/event/fragment_subevent_choice_simple.html" %}
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if not request.event.has_subevents or subevent %}
|
||||
{% include "pretixcontrol/event/fragment_timeline.html" %}
|
||||
{% endif %}
|
||||
<div class="dashboard">
|
||||
{% for w in widgets %}
|
||||
<div class="widget-container widget-{{ w.display_size|default:"small" }}">
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from datetime import timedelta
|
||||
from decimal import Decimal
|
||||
|
||||
import pytz
|
||||
@@ -22,6 +23,7 @@ from pretix.base.models import (
|
||||
WaitingListEntry,
|
||||
)
|
||||
from pretix.base.models.checkin import CheckinList
|
||||
from pretix.base.timeline import timeline_for_event
|
||||
from pretix.control.forms.event import CommentForm
|
||||
from pretix.control.signals import (
|
||||
event_dashboard_widgets, user_dashboard_widgets,
|
||||
@@ -279,6 +281,7 @@ def event_index(request, organizer, event):
|
||||
ctx = {
|
||||
'widgets': rearrange(widgets),
|
||||
'logs': qs[:5],
|
||||
'subevent': subevent,
|
||||
'actions': a_qs[:5] if can_change_orders else [],
|
||||
'comment_form': CommentForm(initial={'comment': request.event.comment})
|
||||
}
|
||||
@@ -302,7 +305,19 @@ def event_index(request, organizer, event):
|
||||
for a in ctx['actions']:
|
||||
a.display = a.display(request)
|
||||
|
||||
return render(request, 'pretixcontrol/event/index.html', ctx)
|
||||
ctx['timeline'] = [
|
||||
{
|
||||
'date': t.datetime.astimezone(request.event.timezone).date(),
|
||||
'entry': t,
|
||||
'time': t.datetime.astimezone(request.event.timezone)
|
||||
}
|
||||
for t in timeline_for_event(request.event, subevent)
|
||||
]
|
||||
ctx['today'] = now().astimezone(request.event.timezone).date()
|
||||
ctx['nearly_now'] = now().astimezone(request.event.timezone) - timedelta(seconds=20)
|
||||
resp = render(request, 'pretixcontrol/event/index.html', ctx)
|
||||
# resp['Content-Security-Policy'] = "style-src 'unsafe-inline'"
|
||||
return resp
|
||||
|
||||
|
||||
def annotated_event_query(request):
|
||||
|
||||
Reference in New Issue
Block a user