mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 20:16:44 +00:00
Fix plugin pickeling (#5412)
This commit is contained in:
parent
af14cef29c
commit
1fe382e318
@ -103,6 +103,12 @@ class PluginConfig(InvenTree.models.MetadataMixin, models.Model):
|
|||||||
# Save plugin
|
# Save plugin
|
||||||
self.plugin: InvenTreePlugin = plugin
|
self.plugin: InvenTreePlugin = plugin
|
||||||
|
|
||||||
|
def __getstate__(self):
|
||||||
|
"""Customize pickeling behaviour."""
|
||||||
|
state = super().__getstate__()
|
||||||
|
state.pop("plugin", None) # plugin cannot be pickelt in some circumstances when used with drf views, remove it (#5408)
|
||||||
|
return state
|
||||||
|
|
||||||
def save(self, force_insert=False, force_update=False, *args, **kwargs):
|
def save(self, force_insert=False, force_update=False, *args, **kwargs):
|
||||||
"""Extend save method to reload plugins if the 'active' status changes."""
|
"""Extend save method to reload plugins if the 'active' status changes."""
|
||||||
reload = kwargs.pop('no_reload', False) # check if no_reload flag is set
|
reload = kwargs.pop('no_reload', False) # check if no_reload flag is set
|
||||||
|
Loading…
x
Reference in New Issue
Block a user