Time machine mode [Z#23129725] (#3961)

Allows organizers to test their shop as if it were a different date and time.

Implemented using a time_machine_now() function which is used instead of regular now(), which can overlay the real date time with a value from a ContextVar, assigned from a session value in EventMiddleware.

For more information, see doc/development/implementation/timemachine.rst

---------

Co-authored-by: Richard Schreiber <schreiber@rami.io>
Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
Mira
2024-05-17 10:52:17 +02:00
committed by GitHub
parent bfcca7046a
commit b638c00952
38 changed files with 789 additions and 142 deletions

View File

@@ -46,7 +46,7 @@
{% endfor %}
</ul>
</div>
<div class="test-right">
<div class="text-right">
<button type="submit" class="btn btn-primary btn-lg btn-save" disabled>
{% trans "Go live" %}
</button>
@@ -82,10 +82,10 @@
<p>
{% trans "Your shop is currently in test mode. All orders are not persistent and can be deleted at any point." %}
</p>
<div class="form-inline">
<label class="checkbox">
<div class="checkbox">
<label>
<input type="checkbox" name="delete" value="yes" />
{% trans "Permanently delete all orders created in test mode" %}
<b>{% trans "Permanently delete all orders created in test mode" %}</b>
</label>
</div>
<div class="text-right">

View File

@@ -0,0 +1,9 @@
{% load eventurl %}
{% load static %}
<form action="{% eventurl request.event "presale:event.auth" %}{% if request.GET.next %}?next={{ request.GET.next }}{% endif %}" method="post">
<input type="hidden" value="{{ new_session }}" name="session">
<button type="submit">
Continue
</button>
</form>
<script src="{% static "pretixcontrol/js/send_form.js" %}"></script>