Skip to content

filter_fields should be renamed to filterset_fields - #74

Open
dameyerdave wants to merge 2 commits into
drf-forms:masterfrom
dameyerdave:filter_to_filterset
Open

filter_fields should be renamed to filterset_fields#74
dameyerdave wants to merge 2 commits into
drf-forms:masterfrom
dameyerdave:filter_to_filterset

Conversation

@dameyerdave

@dameyerdave dameyerdave commented Dec 7, 2022

Copy link
Copy Markdown

Because filter_fields are no longer supported in the latest version of the django-filter package we should change the filter_fields to filterset_fields. For backward compatibility we can allow filter_fields as a possible class variable but we need to convert it internally to filterset_fields.

Thank you for integrating this change.

@dameyerdave

Copy link
Copy Markdown
Author

What do you think? Could this soon be integrated? I'd very much appreciate 🙏

@nanuxbe

nanuxbe commented Feb 21, 2023

Copy link
Copy Markdown
Contributor

Yes, you are right filterset_fields is now the default for django-filters. For backward compatibility and documentation's sake, I think it should stay as filter_fields in drf-schema-adapter .

The changes proposed look extensive but I am worried about external apps using the result of the exporters and the renames there.

For now, I have released 3.0.1 which populates filterset_fields on the viewset, in addition to still populating filter_fieldsto stay backwards compatible

@dameyerdave

Copy link
Copy Markdown
Author

For now, I have released 3.0.1 which populates filterset_fields on the viewset, in addition to still populating filter_fieldsto stay backwards compatible

If this fixes the compatibility issue with current django-filter version I'm happy.

@dameyerdave

Copy link
Copy Markdown
Author

The changes proposed look extensive but I am worried about external apps using the result of the exporters and the renames there.

I don't understand what you exactly mean by this exporters. afaik this is only the Ember adapter that has this slight change in the MetaDataInfo. Or do you think about custom written adapters? As soon as they update to a newer version of django_filters they run into the same compatibility issues as I did... I think changing it to the current filterset_fields would make the most sense. Anyhow - it's your repository and your decision in the end.

@nanuxbe

nanuxbe commented Feb 21, 2023

Copy link
Copy Markdown
Contributor

If this fixes the compatibility issue with current django-filter version I'm happy.

Then I guess you are happy ;-)

Or do you think about custom written adapters

yes, I am thinking about those but not only. With the change in 3.0.1 the compatibility with django-filters (whichever version) is guaranteed and the meta data format also stays the same for those who would have written custom exporters and/or rely on the format of exporters in the implementation of client application that rely on that data

@dameyerdave

Copy link
Copy Markdown
Author

Yeah, then I will check this out. Many thanks for integrating this change.

@nanuxbe

nanuxbe commented Feb 21, 2023

Copy link
Copy Markdown
Contributor

You are welcome. I am keeping this PR open for now for further thinking on how to better reconcile the 2 naming conventions (something that will probably stay compatible with both way)

@asmaps

asmaps commented Mar 2, 2023

Copy link
Copy Markdown
Contributor

I think there's the same problem with filter_class -> filterset_class as I can not get base_filter_class to work. After digging in the code I think it boils down to the same issue as only filter_class is set and not filterset_class. Working around via base_viewset now, but this adds a lot of unnecessary code.

@nanuxbe

nanuxbe commented Mar 10, 2023

Copy link
Copy Markdown
Contributor

@asmaps Yes, you are right, 3.0.6 should fix that issue

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.

3 participants