fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ce23e0c
)
fix for bookmarks
author
Radek Czajka
<rczajka@rczajka.pl>
Tue, 16 Jun 2026 11:22:04 +0000
(13:22 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Tue, 16 Jun 2026 11:22:04 +0000
(13:22 +0200)
src/bookmarks/api/views.py
patch
|
blob
|
history
diff --git
a/src/bookmarks/api/views.py
b/src/bookmarks/api/views.py
index
82502e9
..
315624f
100644
(file)
--- a/
src/bookmarks/api/views.py
+++ b/
src/bookmarks/api/views.py
@@
-48,6
+48,17
@@
class BookmarkSerializer(serializers.ModelSerializer):
fields = ['book_slug', 'book', 'anchor', 'audio_timestamp', 'mode', 'note', 'href', 'uuid', 'location', 'timestamp', 'deleted']
read_only_fields = ['uuid', 'mode']
fields = ['book_slug', 'book', 'anchor', 'audio_timestamp', 'mode', 'note', 'href', 'uuid', 'location', 'timestamp', 'deleted']
read_only_fields = ['uuid', 'mode']
+ def create(self, validated_data):
+ book = validated_data.pop('book_slug', None)
+ if book is not None:
+ validated_data['book'] = book
+ return super().create(validated_data)
+
+ def update(self, instance, validated_data):
+ book = validated_data.pop('book_slug', None)
+ if book is not None:
+ validated_data['book'] = book
+ return super().update(instance, validated_data)
@never_cache
class BookmarksView(ListCreateAPIView):
@never_cache
class BookmarksView(ListCreateAPIView):