From a534350c38f5ce7ee5158371660e65894ee7d973 Mon Sep 17 00:00:00 2001 From: Adibov Date: Sun, 26 Nov 2023 10:26:17 +0330 Subject: [PATCH] fix: redirect to login page after signup verification --- backend/backend_api/admin.py | 2 +- backend/backend_api/views.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/backend_api/admin.py b/backend/backend_api/admin.py index 8cb1d44..cbe6174 100644 --- a/backend/backend_api/admin.py +++ b/backend/backend_api/admin.py @@ -112,7 +112,7 @@ def has_add_permission(self, request): return False def has_delete_permission(self, request, obj=None): - return False + return request.user.is_staff class Meta: model = models.Payment diff --git a/backend/backend_api/views.py b/backend/backend_api/views.py index fc2385f..fe26106 100644 --- a/backend/backend_api/views.py +++ b/backend/backend_api/views.py @@ -1,7 +1,9 @@ import datetime +import os +import urllib.parse from django.core.exceptions import ObjectDoesNotExist -from django.shortcuts import get_object_or_404 +from django.shortcuts import get_object_or_404, redirect from rest_framework import status, mixins from rest_framework import viewsets from rest_framework.decorators import action @@ -12,6 +14,7 @@ ) from rest_framework.response import Response +from aaiss_backend.settings import BASE_URL from backend_api import models from backend_api import serializers from backend_api.models import User, Account, Payment, Staff, WorkshopRegistration, PresentationParticipation @@ -205,7 +208,7 @@ def activate(self, request): status.HTTP_400_BAD_REQUEST, "Token didn't match with any user")) account.is_active = True account.save() - return Response(new_detailed_response(status.HTTP_200_OK, "User activated successfully")) + return redirect(urllib.parse.urljoin(BASE_URL, 'signup')) class PaymentViewSet(viewsets.GenericViewSet):