Skip to content

Commit

Permalink
Serializar does not return invalid path names for secondary locations
Browse files Browse the repository at this point in the history
  • Loading branch information
José Redrejo committed Nov 23, 2022
1 parent 70ae22e commit b4dbede
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion kolibri/core/device/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,20 @@ def create(self, validated_data):
}


class PathListField(serializers.ListField):
def to_representation(self, data):
return [
self.child.to_representation(item)
for item in data
if check_is_directory(item)
]


class DeviceSettingsSerializer(DeviceSerializerMixin, serializers.ModelSerializer):

extra_settings = serializers.JSONField(required=False)
primary_storage_location = serializers.CharField(required=False)
secondary_storage_locations = serializers.ListField(
secondary_storage_locations = PathListField(
child=serializers.CharField(required=False), required=False
)

Expand Down

0 comments on commit b4dbede

Please sign in to comment.