Skip to content

INTPYTHON-658 Add PolymorphicEmbeddedModelArrayField #335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

timgraham
Copy link
Collaborator

@timgraham timgraham commented Jul 8, 2025

todo:

  • unsure if all subquery tests from EmbeddedModelArrayField need to be repeated
  • topic guide documentation

@timgraham timgraham force-pushed the polymorphic-array branch from 729fd87 to d348536 Compare July 14, 2025 20:25
@timgraham timgraham marked this pull request as ready for review July 14, 2025 21:43
@timgraham timgraham requested a review from WaVEV July 14, 2025 21:43
super().contribute_to_class(cls, name, private_only=private_only, **kwargs)

if not cls._meta.abstract:
# If the embedded_model argument is a string, resolve it to the
Copy link
Collaborator

@WaVEV WaVEV Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the embedded_models is a list of string...

or it is an string?

def test_array_slice(self):
self.assertSequenceEqual(Owner.objects.filter(pets__0_1__name="Woofer"), [self.fred])

# def test_filter_unsupported_lookups_in_json(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this test a valid test or shouldn't be considered?

Copy link
Collaborator

@WaVEV WaVEV Jul 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that transform is almost the same, it will work in the same way. So, it is already tested.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the commented tests are copied from EmbeddedModelArrayField tests. I don't think they need to be re-implemented here, but I left them for your opinion.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transform.get_transform is the same, the lookups will work in the same way. So, they aren't needed and the lookups are also registered.

@timgraham timgraham force-pushed the polymorphic-array branch from d348536 to e9ae1a5 Compare July 16, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants