From bfd4944abe92f49575e6520979a912d6fb54cd7a Mon Sep 17 00:00:00 2001 From: git-hyagi <45576767+git-hyagi@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:19:08 -0300 Subject: [PATCH] wip create a widget for binaryfield --- pulp_container/app/modelresource.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pulp_container/app/modelresource.py b/pulp_container/app/modelresource.py index dfd7e8f85..801d330e0 100644 --- a/pulp_container/app/modelresource.py +++ b/pulp_container/app/modelresource.py @@ -13,6 +13,14 @@ ) +class BinaryWidget(widgets.Widget): + def clean(self, value, row=None, **kwargs): + return bytes.fromhex(value) + + def render(self, value, obj=None): + return value.hex() + + class ContainerRepositoryResource(RepositoryResource): """ A resource for importing/exporting repositories of the sync type @@ -65,6 +73,11 @@ class BlobResource(BaseContentResource): Resource for import/export of blob entities """ + data = fields.Field( + column_name="data", + attribute="data", + widget=BinaryWidget() + ) def set_up_queryset(self): """ :return: Blobs specific to a specified repo-version.