Revert "Return 404 for old tokens."

This reverts commit 9e576b9f49.
This commit is contained in:
Víðir Valberg Guðmundsson 2021-08-19 10:33:21 +02:00
parent 9e576b9f49
commit df10fc89c6

View file

@ -1,11 +1,9 @@
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import Http404
from django.shortcuts import redirect from django.shortcuts import redirect
from django.urls import reverse from django.urls import reverse
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from ..utils.models import CampReadOnlyModeError
from .models import Token, TokenFind from .models import Token, TokenFind
@ -15,14 +13,10 @@ class TokenFindView(LoginRequiredMixin, DetailView):
slug_url_kwarg = "token" slug_url_kwarg = "token"
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
# register this token find if it isn't already # register this tokenview if it isn't already
try: token, created = TokenFind.objects.get_or_create(
token, created = TokenFind.objects.get_or_create( token=self.get_object(), user=request.user
token=self.get_object(), user=request.user )
)
except CampReadOnlyModeError:
raise Http404
if created: if created:
messages.success( messages.success(
self.request, self.request,