1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 05:25:26 +02:00

add explicit handling for empty 1:many lists

This commit is contained in:
Michael Genson 2023-11-25 16:59:23 +00:00
parent fcd4854cb8
commit ff115284d9

View file

@ -20,5 +20,11 @@ class BaseMixins:
`self.update` method which directly passing arguments to the `__init__`
"""
def update(self, *args, **kwarg):
self.__init__(*args, **kwarg)
def update(self, *args, **kwargs):
self.__init__(*args, **kwargs)
# sqlalchemy doesn't like this method to remove all instances of a 1:many relationship,
# so we explicitly check for that here
for k, v in kwargs.items():
if hasattr(self, k) and v == []:
setattr(self, k, v)