From af57cd5db9078aa25a61e4f76f34615ebef82d0f Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Tue, 14 Jan 2025 05:19:08 +0000 Subject: [PATCH] Have closed staff and dealer pages return back to reg index We'll revert staff and dealer closed pages back to having them send the user to the registration index, which from there they can decide whether they want to continue to the registration process. If the registration page is closed and the website url is set, then the user can click "Back to Main Page" go back to the website's main URL. --- .../registration/dealer/dealer-closed.html | 2 +- .../registration/staff/staff-closed.html | 2 +- registration/tests/test_dealers.py | 15 --------------- registration/tests/test_staff.py | 14 -------------- registration/views/dealers.py | 6 ------ registration/views/staff.py | 13 ------------- 6 files changed, 2 insertions(+), 50 deletions(-) diff --git a/registration/templates/registration/dealer/dealer-closed.html b/registration/templates/registration/dealer/dealer-closed.html index 1b061c20..899b4a9d 100644 --- a/registration/templates/registration/dealer/dealer-closed.html +++ b/registration/templates/registration/dealer/dealer-closed.html @@ -8,7 +8,7 @@

Dealer Registration - {{ event }}

Dealer registration for {{ event }} {{ message }}

If you have any questions please contact {{ event.dealerEmail }}

-

Back to Main Page

+

Back to Main Page

{% endblock %} diff --git a/registration/templates/registration/staff/staff-closed.html b/registration/templates/registration/staff/staff-closed.html index 342f788c..f1f9b666 100644 --- a/registration/templates/registration/staff/staff-closed.html +++ b/registration/templates/registration/staff/staff-closed.html @@ -10,7 +10,7 @@

Staff Registration - {{ event }}

{{ event.staffEmail }}

- Back to Main Page + Back to Main Page

diff --git a/registration/tests/test_dealers.py b/registration/tests/test_dealers.py index 43e941db..335a7498 100644 --- a/registration/tests/test_dealers.py +++ b/registration/tests/test_dealers.py @@ -62,13 +62,6 @@ def test_addNewDealer_closed_upcoming(self) -> None: self.assertIn(b"not yet open", response.content) self.assertIn(b'Back to Main Page', response.content) - self.event.websiteUrl = "https://example.com" - self.event.save() - - response = self.client.get(reverse("registration:new_dealer")) - self.assertEqual(response.status_code, 200) - self.assertIn(b'Back to Main Page', response.content) - @freeze_time(timezone.now() + timedelta(days=20)) def test_addNewDealer_closed_ended(self) -> None: response = self.client.get(reverse("registration:new_dealer")) @@ -76,14 +69,6 @@ def test_addNewDealer_closed_ended(self) -> None: self.assertIn(b"has ended", response.content) self.assertIn(b'Back to Main Page', response.content) - event = Event.objects.get(default=True) - event.websiteUrl = "https://example.com" - event.save() - - response = self.client.get(reverse("registration:new_dealer")) - self.assertEqual(response.status_code, 200) - self.assertIn(b'Back to Main Page', response.content) - def test_find_dealer_to_add_assistant(self): response = self.client.get( reverse("registration:find_dealer_to_add_assistant", args=("FOOBAR",)) diff --git a/registration/tests/test_staff.py b/registration/tests/test_staff.py index 9d01a25c..9d9562eb 100644 --- a/registration/tests/test_staff.py +++ b/registration/tests/test_staff.py @@ -135,13 +135,6 @@ def test_new_staff_invite_good_closed_upcoming(self): self.assertIn(b"not yet open", response.content) self.assertIn(b'Back to Main Page', response.content) - self.event.websiteUrl = "https://example.com" - self.event.save() - - response = self.client.get(reverse("registration:new_dealer")) - self.assertEqual(response.status_code, 200) - self.assertIn(b'Back to Main Page', response.content) - @freeze_time(timezone.now() + timedelta(days=20)) def test_new_staff_invite_good_closed_ended(self): body = { @@ -157,13 +150,6 @@ def test_new_staff_invite_good_closed_ended(self): self.assertIn(b"has ended", response.content) self.assertIn(b'Back to Main Page', response.content) - self.event.websiteUrl = "https://example.com" - self.event.save() - - response = self.client.get(reverse("registration:new_dealer")) - self.assertEqual(response.status_code, 200) - self.assertIn(b'Back to Main Page', response.content) - @freeze_time("2000-01-01") def test_new_staff_invite_override(self): body = { diff --git a/registration/views/dealers.py b/registration/views/dealers.py index 60f6a364..171a11d9 100644 --- a/registration/views/dealers.py +++ b/registration/views/dealers.py @@ -73,12 +73,6 @@ def new_dealer(request): tz = timezone.get_current_timezone() today = tz.localize(datetime.now()) context = {"event": event, "venue": venue} - - if event.websiteUrl: - context["homeRedirect"] = event.websiteUrl - else: - context["homeRedirect"] = reverse("registration:index") - if event.dealerRegStart <= today <= event.dealerRegEnd: return render(request, "registration/dealer/dealer-form.html", context) elif event.dealerRegStart >= today: diff --git a/registration/views/staff.py b/registration/views/staff.py index 7cedcdf3..26d14da4 100644 --- a/registration/views/staff.py +++ b/registration/views/staff.py @@ -7,7 +7,6 @@ from django.forms import model_to_dict from django.http import JsonResponse from django.shortcuts import render -from django.urls import reverse from django.views.decorators.http import require_POST import registration.emails @@ -32,12 +31,6 @@ def new_staff(request, guid): tz = timezone.get_current_timezone() today = tz.localize(datetime.now()) context = {"token": guid, "event": event} - - if event.websiteUrl: - context["homeRedirect"] = event.websiteUrl - else: - context["homeRedirect"] = reverse("registration:index") - if event.staffRegStart <= today <= event.staffRegEnd or invite.ignore_time_window is True: return render(request, "registration/staff/staff-new.html", context) elif event.staffRegStart >= today: @@ -173,12 +166,6 @@ def staff_index(request, guid): tz = timezone.get_current_timezone() today = tz.localize(datetime.now()) context = {"token": guid, "event": event} - - if event.websiteUrl: - context["homeRedirect"] = event.websiteUrl - else: - context["homeRedirect"] = reverse("registration:index") - if event.staffRegStart <= today <= event.staffRegEnd: return render(request, "registration/staff/staff-locate.html", context) elif event.staffRegStart >= today: