move image path
This commit is contained in:
parent
2ce1356412
commit
54afa8aae5
@ -4,7 +4,7 @@ from rest_framework import permissions, status
|
|||||||
from rest_framework import viewsets
|
from rest_framework import viewsets
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
|
||||||
|
from django.http import HttpRequest
|
||||||
from django.db.models import QuerySet
|
from django.db.models import QuerySet
|
||||||
|
|
||||||
from .serializers import ProfileSerializer
|
from .serializers import ProfileSerializer
|
||||||
@ -16,6 +16,12 @@ class ProfileViewSet(viewsets.ModelViewSet):
|
|||||||
parser_classes = (MultiPartParser, FormParser)
|
parser_classes = (MultiPartParser, FormParser)
|
||||||
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
|
permission_classes = (permissions.IsAuthenticatedOrReadOnly,)
|
||||||
|
|
||||||
|
def retrieve(self, request: HttpRequest, pk=None):
|
||||||
|
instance = self.get_object()
|
||||||
|
instance.avatar_url.name = instance.avatar_url.name.replace("profiles", "", 1)
|
||||||
|
return Response(self.serializer_class(instance).data,
|
||||||
|
status=status.HTTP_200_OK)
|
||||||
|
|
||||||
def perform_create(self, serializer):
|
def perform_create(self, serializer):
|
||||||
serializer.save(user=self.request.user)
|
serializer.save(user=self.request.user)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user