Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
deepansh96 committed Jan 31, 2022
1 parent 83cf2d1 commit bb5f274
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
6 changes: 2 additions & 4 deletions organizations/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from rest_framework import viewsets, status
from rest_framework import viewsets
from organizations.models import Organization
from organizations.serializers import OrganizationSerializer
from rest_framework.permissions import IsAuthenticated
Expand Down Expand Up @@ -34,6 +34,4 @@ def setting(self, request, pk):
org.config = org.config if org.config is not None else {}
org.config["settings"] = self.request.data
org.save()
return Response(
self.get_serializer(org).data["config"]
)
return Response(self.get_serializer(org).data["config"])
9 changes: 3 additions & 6 deletions plio/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,10 @@ def perform_update(self, serializer):
def setting(self, request, uuid):
"""Updates a plio's settings"""
plio = self.get_object()
config = plio.config if plio.config is not None else {}
config["settings"] = self.request.data
plio.config = config
plio.config = plio.config if plio.config is not None else {}
plio.config["settings"] = self.request.data
plio.save()
return Response(
self.get_serializer(plio).data["config"], status=status.HTTP_200_OK
)
return Response(self.get_serializer(plio).data["config"])

@property
def organization_shortcode(self):
Expand Down
8 changes: 3 additions & 5 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ def setting(self, request, pk):
user = self.get_object()
user.config["settings"] = self.request.data
user.save()
return Response(
self.get_serializer(user).data["config"], status=status.HTTP_200_OK
)
return Response(self.get_serializer(user).data["config"])

@action(
detail=True,
Expand Down Expand Up @@ -221,7 +219,7 @@ def verify_otp(request):

# login the user, get the new access token and return
token = login_user_and_get_access_token(user, request)
return Response(token, status=status.HTTP_200_OK)
return Response(token)

except OneTimePassword.DoesNotExist:
return Response({"detail": "unauthorized"}, status=status.HTTP_401_UNAUTHORIZED)
Expand Down Expand Up @@ -282,4 +280,4 @@ def generate_external_auth_access_token(request):

# login the user, get the new access token and return
token = login_user_and_get_access_token(user, request)
return Response(token, status=status.HTTP_200_OK)
return Response(token)

0 comments on commit bb5f274

Please sign in to comment.