Skip to content
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

Fix querying on related model's I18n_TextField #11800 #11801

Open
wants to merge 1 commit into
base: dev/8.0.x
Choose a base branch
from

Conversation

jacobtylerwalls
Copy link
Member

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Description of Change

Before, queries failed when trying to filter on a related model's I18n_TextField.

Issues Solved

Closes #11800

Checklist

  • I targeted one of these branches:
    • dev/8.0.x (under development): features, bugfixes not covered below
    • dev/7.6.x (main support): regressions, crashing bugs, security issues, major bugs in new features
    • dev/6.2.x (extended support): major security issues, data loss issues
  • I added a changelog in arches/releases
  • [n/a] I submitted a PR to arches-docs (if appropriate)
  • Unit tests pass locally with my changes
  • I added tests that prove my fix is effective or that my feature works
  • My test fails on the target branch

Comment on lines -66 to +67
if (self.value_is_primitive or self.value is None) and not isinstance(
compiler, SQLInsertCompiler
if (self.value_is_primitive or self.value is None) and isinstance(
compiler, SQLUpdateCompiler
Copy link
Member Author

Choose a reason for hiding this comment

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

For a filter() call, this was coming in as just SQLCompiler.

Comment on lines +22 to +23
def test_filter_related_model_i18n_text_field(self):
self.assertEqual(Node.objects.filter(graph__name__en="Graph Name").count(), 0)
Copy link
Member Author

Choose a reason for hiding this comment

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

The other test classes in this file use custom models, but they didn't have foreign keys set up, so it seemed simpler to just dogfood the real models. Open to changing this.

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.

I18n_TextFields can't participate in related lookups
1 participant