Skip to content

Commit

Permalink
wip create a widget for binaryfield
Browse files Browse the repository at this point in the history
  • Loading branch information
git-hyagi committed Apr 23, 2024
1 parent 3c80553 commit 2095f92
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pulp_container/app/modelresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2095f92

Please sign in to comment.