Skip to content

Commit

Permalink
fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
viggo-devries committed Dec 28, 2023
1 parent 762bec7 commit 86ecce7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 1 addition & 5 deletions oscar_odin/django_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ def get_field_dict(self) -> Dict[str, Optional[Field]]:
"""Get a dictionary of fields from the source object."""
meta = getmeta(self.obj)

if meta.object_name == "Product":
# pylint: disable=protected-access
fields = meta._forward_fields_map
else:
fields = {f.name: f for f in meta.fields}
fields = meta._forward_fields_map

fields.update(
(r.related_name, r.field)
Expand Down
1 change: 0 additions & 1 deletion oscar_odin/resources/catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class ProductClass(OscarCatalogue):
slug: str
requires_shipping: bool
track_stock: bool
options: List[str]


class Structure(str, enum.Enum):
Expand Down
14 changes: 12 additions & 2 deletions tests/reverse/test_reallifecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,25 @@ def images(self, image, app_image):
a = urlparse(image)
img = File(io.BytesIO(response.content), name=path.basename(a.path))
images.append(
ImageResource(display_order=0, code="%s?upc=%s" % (self.source.number, image), caption="", original=img)
ImageResource(
display_order=0,
code="%s?upc=%s" % (self.source.number, image),
caption="",
original=img,
)
)

if app_image and app_image != image:
response = requests.get(app_image)
a = urlparse(app_image)
img = File(io.BytesIO(response.content), name=path.basename(a.path))
images.append(
ImageResource(display_order=1, caption="", code="%s?upc=%s-2" % (self.source.number, image), original=img)
ImageResource(
display_order=1,
caption="",
code="%s?upc=%s-2" % (self.source.number, image),
original=img,
)
)

return images
Expand Down

0 comments on commit 86ecce7

Please sign in to comment.