improve documentation

This commit is contained in:
Mira Weller
2024-04-22 14:05:10 +02:00
parent 569f1719b0
commit 2d335cd095

View File

@@ -1,17 +1,17 @@
Time machine mode
=================
In test mode, pretix provides a time machine feature which allows event organizers
to test their shop as if it were a different date and time. This time machine mode
is implemented by calling our custom :py:meth:`time_machine_now()` function instead of
:py:meth:`django.utils.timezone.now()` in all places where the time should be
modifiable. If you add code that uses the current date and time for checking whether some
In test mode, pretix provides a "time machine" feature which allows event organizers
to test their shop as if it were a different date and time. To enable this feature, they can
click on the clock icon in the test mode warning box.
Internally, this time machine mode is implemented by calling our custom :py:meth:`time_machine_now()`
function instead of :py:meth:`django.utils.timezone.now()` in all places where the fake time should be
taken into account. If you add code that uses the current date and time for checking whether some
product can be bought, you should use :py:meth:`time_machine_now`.
.. autofunction:: pretix.base.timemachine.time_machine_now
.. autofunction:: pretix.base.timemachine.time_machine_now_assigned
Background tasks
----------------
@@ -29,10 +29,4 @@ respected, you need to pass it through manually as shown in the example below:
my_task.apply_async(kwargs={'override_now_dt': time_machine_now(default=None)})
.. autofunction:: pretix.base.timemachine.time_machine_now_assigned