mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 12:18:45 -05:00
fixed shopping list share permission
This commit is contained in:
@@ -45,6 +45,11 @@ class PermissionModelMixin:
|
||||
return self.user
|
||||
return None
|
||||
|
||||
def get_shared(self):
|
||||
if getattr(self, 'shared', None):
|
||||
return self.shared.all()
|
||||
return []
|
||||
|
||||
def get_space(self):
|
||||
p = '.'.join(self.get_space_key())
|
||||
if getattr(self, p, None):
|
||||
@@ -549,6 +554,9 @@ class ShoppingListEntry(models.Model, PermissionModelMixin):
|
||||
def __str__(self):
|
||||
return f'Shopping list entry {self.id}'
|
||||
|
||||
def get_shared(self):
|
||||
return self.shoppinglist_set.first().shared.all()
|
||||
|
||||
def get_owner(self):
|
||||
try:
|
||||
return self.shoppinglist_set.first().created_by
|
||||
|
||||
Reference in New Issue
Block a user