Skip to content

Commit

Permalink
Merge branch 'master' into plugin-reload-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat authored May 27, 2024
2 parents a4831af + eb3c8dd commit f0a996b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/backend/InvenTree/InvenTree/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,15 @@ def get_serializer_info(self, serializer):
serializer_info = super().get_serializer_info(serializer)

# Look for any dynamic fields which were not available when the serializer was instantiated
for field_name in serializer.Meta.fields:
if field_name in serializer_info:
# Already know about this one
continue

if hasattr(serializer, field_name):
field = getattr(serializer, field_name)
serializer_info[field_name] = self.get_field_info(field)
if hasattr(serializer, 'Meta'):
for field_name in serializer.Meta.fields:
if field_name in serializer_info:
# Already know about this one
continue

if hasattr(serializer, field_name):
field = getattr(serializer, field_name)
serializer_info[field_name] = self.get_field_info(field)

model_class = None

Expand Down
20 changes: 20 additions & 0 deletions src/backend/InvenTree/plugin/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ class PluginConfigEmptySerializer(serializers.Serializer):
class PluginReloadSerializer(serializers.Serializer):
"""Serializer for remotely forcing plugin registry reload."""

class Meta:
"""Meta for serializer."""

fields = ['full_reload', 'force_reload', 'collect_plugins']

full_reload = serializers.BooleanField(
required=False,
default=False,
Expand Down Expand Up @@ -189,6 +194,11 @@ class PluginActivateSerializer(serializers.Serializer):

model = PluginConfig

class Meta:
"""Metaclass for serializer."""

fields = ['active']

active = serializers.BooleanField(
required=False,
default=True,
Expand All @@ -213,6 +223,11 @@ def update(self, instance, validated_data):
class PluginUninstallSerializer(serializers.Serializer):
"""Serializer for uninstalling a plugin."""

class Meta:
"""Metaclass for serializer."""

fields = ['delete_config']

delete_config = serializers.BooleanField(
required=False,
default=True,
Expand Down Expand Up @@ -253,6 +268,11 @@ class NotificationUserSettingSerializer(GenericReferencedSettingSerializer):
class PluginRegistryErrorSerializer(serializers.Serializer):
"""Serializer for a plugin registry error."""

class Meta:
"""Meta for serializer."""

fields = ['stage', 'name', 'message']

stage = serializers.CharField()
name = serializers.CharField()
message = serializers.CharField()
Expand Down

0 comments on commit f0a996b

Please sign in to comment.