mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-21 09:39:46 -05:00
Allow posting partial updates of extra attributes
This commit is contained in:
1 parent
cd274a9968
commit
28f6f8e916
1 file changed
+2
-1
@@ -231,7 +231,8 @@ async def update(
|
||||
elif isinstance(v, datetime):
|
||||
setattr(spool, k, utc_timezone_naive(v))
|
||||
elif k == "extra":
|
||||
spool.extra = [models.SpoolField(key=k, value=v) for k, v in v.items()]
|
||||
spool.extra = [ f for f in spool.extra if f.key not in v.keys()]
|
||||
spool.extra.extend([models.SpoolField(key=k, value=v) for k, v in v.items()])
|
||||
else:
|
||||
setattr(spool, k, v)
|
||||
await db.commit()
|
||||
|
||||
Reference in new issue
Block a user