Skip to content

Commit

Permalink
changed for styles check
Browse files Browse the repository at this point in the history
  • Loading branch information
leuneri committed Nov 1, 2023
1 parent 1d0dbdf commit dd5289f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions backend/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from rest_framework.response import Response
from .models import Admin, Bidder


@api_view(['POST'])
def set_user_role(request):
email = request.data.get("email")
Expand Down Expand Up @@ -33,7 +34,8 @@ def set_user_role(request):
bidder.is_blacklisted = request.data.get("is_blacklisted")
bidder.save()

return Response({"message": f"User has been converted to {role} and fields have been populated"})
return Response({"message": f"User converted to {role}, fields populated"})


@api_view(['PUT'])
def update_user_profile(request, email, role):
Expand All @@ -48,7 +50,6 @@ def update_user_profile(request, email, role):
return Response({"message": "Admin has been updated"})
except Admin.DoesNotExist:
return Response({"error": "Admin not found"}, status=400)

elif role == "bidder":
try:
bidder = Bidder.objects.get(email=email)
Expand All @@ -61,8 +62,6 @@ def update_user_profile(request, email, role):
bidder.save()
return Response({"message": "Bidder has been updated"})
except Bidder.DoesNotExist:
return Response({"error": "Bidder not found"}, status=400)

return Response({"error": "Bidder not found"}, status=400)
else:
return Response({"error": "Invalid role"}, status=400)

return Response({"error": "Invalid role"}, status=400)

0 comments on commit dd5289f

Please sign in to comment.