mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
Merge pull request #753 from mouse-reeve/default-shelf-user
Set shelf user by default
This commit is contained in:
commit
833e66dac3
1 changed files with 5 additions and 0 deletions
|
@ -68,6 +68,11 @@ class ShelfBook(CollectionItemMixin, BookWyrmModel):
|
|||
object_field = "book"
|
||||
collection_field = "shelf"
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.user:
|
||||
self.user = self.shelf.user
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
"""an opinionated constraint!
|
||||
you can't put a book on shelf twice"""
|
||||
|
|
Loading…
Reference in a new issue