Browse Source

bookmars fixed.

master
Mohsen Taba 5 months ago
parent
commit
dc53a5a76d
  1. 4
      apps/bookmark/models/bookmark.py
  2. 7
      apps/bookmark/views/bookmark.py

4
apps/bookmark/models/bookmark.py

@ -76,8 +76,8 @@ class Bookmark(models.Model):
from apps.podcast.models import PodcastPlaylist
return PodcastPlaylist.objects.filter(id=content_id).exists()
elif service == cls.ServiceChoices.HADITH:
from apps.hadith.models import Hadith
return Hadith.objects.filter(id=content_id).exists()
from apps.hadis.models import Hadis
return Hadis.objects.filter(id=content_id).exists()
elif service == cls.ServiceChoices.VIDEO:
from apps.video.models import Video
return Video.objects.filter(id=content_id).exists()

7
apps/bookmark/views/bookmark.py

@ -22,7 +22,10 @@ class AddBookmarkView(CreateAPIView):
serializer_class = BookmarkSerializer
@swagger_auto_schema(
operation_description="Add a bookmark for a specific content in a service. If the bookmark already exists but is inactive, it will be reactivated.",
operation_description="Add a bookmark for a specific content in a service.\
If the bookmark already exists but is inactive, it will be reactivated.\
\n Services must be choose from : \n \
'Library'\n'Podcast'\n'Podcast Playlist'\n'Hadith'\n'Video'\n'Video Playlist'\n'Article'",
tags=["Dobodbi - Bookmarks"],
request_body=BookmarkSerializer,
responses={
@ -31,7 +34,7 @@ class AddBookmarkView(CreateAPIView):
400: "Invalid input."
}
)
def post(self, request, pk, *args, **kwargs):
def post(self, request, *args, **kwargs):
return super().post(request,*args, **kwargs)
def create(self, request, *args, **kwargs):
service = request.data.get('service')

Loading…
Cancel
Save