Changes from review

This commit is contained in:
Mira Weller
2024-04-30 21:49:58 +02:00
parent 64358be4ae
commit 204b8e53de
5 changed files with 11 additions and 25 deletions
+2 -2
View File
@@ -504,7 +504,7 @@ class Order(LockModel, LoggedModel):
if 'update_fields' in kwargs:
kwargs['update_fields'] = {'code'}.union(kwargs['update_fields'])
if not self.datetime:
self.datetime = time_machine_now()
self.datetime = now()
if 'update_fields' in kwargs:
kwargs['update_fields'] = {'datetime'}.union(kwargs['update_fields'])
if not self.expires:
@@ -541,7 +541,7 @@ class Order(LockModel, LoggedModel):
self.save(update_fields=['last_modified'])
def set_expires(self, now_dt=None, subevents=None):
now_dt = now_dt or time_machine_now()
now_dt = now_dt or now()
tz = ZoneInfo(self.event.settings.timezone)
mode = self.event.settings.get('payment_term_mode')
if mode == 'days':
+1 -13
View File
@@ -20,18 +20,6 @@
# <https://www.gnu.org/licenses/>.
#
# This file is based on an earlier version of pretix which was released under the Apache License 2.0. The full text of
# the Apache License 2.0 can be obtained at <http://www.apache.org/licenses/LICENSE-2.0>.
#
# This file may have since been changed and any changes are released under the terms of AGPLv3 as described above. A
# full history of changes and contributors is available at <https://github.com/pretix/pretix>.
#
# This file contains Apache-licensed contributions copyrighted by: Tobias Kunze
#
# Unless required by applicable law or agreed to in writing, software distributed under the Apache License 2.0 is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under the License.
import threading
from contextlib import contextmanager
@@ -47,7 +35,7 @@ class TimeMachineMiddleware:
super().__init__()
def __call__(self, request):
if hasattr(request, 'event') and hasattr(request, '_namespace') and request._namespace == 'presale' and \
if hasattr(request, 'event') and hasattr(request, '_namespace') and hasattr(request, '_event_detected') and \
'timemachine_now_dt' in request.session and \
request.event.testmode and request.user.is_authenticated and \
request.user.has_event_permission(request.organizer, request.event, 'can_change_event_settings', request):
+1 -3
View File
@@ -91,9 +91,7 @@ from pretix.control.permissions import EventPermissionRequiredMixin
from pretix.control.views.mailsetup import MailSettingsSetupView
from pretix.control.views.user import RecentAuthenticationRequiredMixin
from pretix.helpers.database import rolledback_transaction
from pretix.multidomain.urlreverse import (
build_absolute_uri, get_event_domain,
)
from pretix.multidomain.urlreverse import build_absolute_uri, get_event_domain
from pretix.plugins.stripe.payment import StripeSettingsHolder
from pretix.presale.style import regenerate_css
@@ -37,10 +37,10 @@
<div class="timemachine-banner">
<div class="container">
<span class="fa fa-clock-o" aria-hidden="true"></span>
{% trans "You are currently using the time machine. The ticket shop is rendered as if it were" %} {{ request.now_dt }}
<a href="{% eventurl event "presale:event.timemachine" %}" class="btn-link">
{% trans "Change" %}
</a>
{% blocktrans trimmed with datetime=request.now_dt|date:"SHORT_DATETIME_FORMAT" %}
You are currently using the time machine. The ticket shop is rendered as if it were {{ datetime }}.
{% endblocktrans %}
<a href="{% eventurl event "presale:event.timemachine" %}" class="btn-link">{% trans "Change" %}</a>
<form action="{% eventurl event "presale:event.timemachine" %}" method="post" class="download-btn-form">
{% csrf_token %}
<button type="submit" class="btn-link" value="true" name="timemachine_disable">{% trans "Go back to current time" %}</button>
@@ -188,18 +188,18 @@ div.front-page {
margin-top: 30px;
}
.offline-banner, .timemachine-banner {
color: white;
width: 100%;
padding: 5px;
text-align: center;
a, .btn-link {
text-decoration: underline;
color: white;
}
}
.offline-banner { background: $brand-danger; }
.offline-banner { background: $brand-danger; color: white; }
.offline-banner a { color: white; }
.timemachine-banner { background: $brand-warning; }
.timemachine-banner a, .timemachine-banner .btn-link { color: $text-color; }
#questions_group .panel-title a {
line-height: 22px;
}