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

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