mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
Set shelf user by default
This commit is contained in:
parent
b816c322b5
commit
b285fb2fc0
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