Merge pull request #753 from mouse-reeve/default-shelf-user

Set shelf user by default
This commit is contained in:
Mouse Reeve 2021-03-16 13:48:12 -07:00 committed by GitHub
commit 833e66dac3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"""