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

Remove non-model-fields from Meta.fields of filters #773

Merged
merged 1 commit into from
Jul 8, 2020

Conversation

ggainey
Copy link
Contributor

@ggainey ggainey commented Jul 7, 2020

Changes include:

  • Meta.fields list may only reference fields that exist in Meta.model
  • 'exact' is redundant in Meta.fields qualifiers (per Mongo docs)
  • Upload.completed was removed in cf5bad, remove referencing filter

closes #6915

@pulpbot
Copy link
Member

pulpbot commented Jul 7, 2020

Attached issue: https://pulp.plan.io/issues/6915

@daviddavis
Copy link
Contributor

'exact' is redundant in Meta.fields qualifiers (per Mongo docs)

Mongo docs?

@ggainey
Copy link
Contributor Author

ggainey commented Jul 7, 2020

'exact' is redundant in Meta.fields qualifiers (per Mongo docs)

Mongo docs?

Oh geez. Lemme fix and repush, thanks for the catch.

Changes include:
  * Meta.fields list may only reference fields that exist in Meta.model
  * 'exact' is redundant in Meta.fields qualifiers (per django-filter docs)
  * Upload.completed was removed in cf5bad, remove referencing filter

closes #6915
@@ -0,0 +1 @@
Corrected a number of filters to be django-filter-2.3.0-compliant.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm conflicted about whether this should be a misc or a bugfix. You think bugfix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a bugfix - it was harmless, but Worng, and in the next release of django-filters it will stop working at all. We should never have been doing this.

@daviddavis
Copy link
Contributor

Tested this out and it seems the filters still work so 👍

@@ -122,8 +122,6 @@ class Meta:
fields = {
"name": NAME_FILTER_OPTIONS,
"last_heartbeat": DATETIME_FILTER_OPTIONS,
"online": ["exact"],
"missing": ["exact"],
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is semantically equivalent. Does this not tell django-filters that you cannot filter on the "online" or "missing" fields?

I'm also entirely confused why this is necessary. This form is still present in the django-filter docs and I can't imagine they would break this in a minor release anyways (we're on 2.2 currently). Why change it?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's redundant since the online and missing filters are defined above. You can still filter on online and missing. Before django-filter 2.3, it just ignored these lines but with django-filter 2.3 it now complains that these fields aren't actually fields.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right, I guess I'm just perplexed that they went from allowing it without a warning to making it a hard error in a point release.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, me too. I did some digging and it looks like this is the issue: carltongibson/django-filter#1013

@daviddavis daviddavis merged commit d3f26b4 into pulp:master Jul 8, 2020
@ggainey ggainey deleted the 6915_django-filter-2.3.0 branch April 27, 2021 13:21
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.

None yet

4 participants