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

Django 4 support: Option 5, migrating to django-filter #491

Closed
wants to merge 10 commits into from

Conversation

terjekv
Copy link
Collaborator

@terjekv terjekv commented Mar 29, 2023

Fixes #487 by implementing option 5 in the issue.

Supports: python3.7+, django 3.2+. Tests included for this range.
Breaking changes: None

This implementation uses django-filter as intended. It sets a default filter backend and uses standard filter_class models where possible.

Exceptions take place in the following views:

  • HostList. Relies on manipulating the queryset, and said manipulation is also used in the filter-less HostDetail.
  • *Zone*List. The abstraction model for these views is based around propagating a filterset into the parent class.

Concerns:

  • This patch creates explicit mapping filters for JSONField and CIDRField. It is unclear how well-tested these are.

terjekv and others added 8 commits March 26, 2023 18:32
BREAKING: This patch makes mreg require python3.9+.

Fixes unioslo#487

This solution implements option 3 and/or 4, using dj-url-filter.

Testing infrastructure:
 - Migrate testing to tox.
 - Migrate coverage configuration to tox.
   - Coverage is not run as a default environment by tox.
   - Locally, one can do `tox -e coverage` to run coverage.
   - Coverage called by tox fails if it drops below 98%.
   - `coverage run manage.py test && coverage report -m` also works.
 - Increase testing scope, via tox the following is now tested:
    - Django3.2 on python3.9
    - Django4.0 on python3.9-3.11
    - Django4.1 on python3.10-3.11
    - Django4.2 (pre-release) on python3.10-3.11
    - Django main branch on python3.11

Dependency changes:
  - To test against Django4.2, django-rest-framework had to be updated to 3.14.0
  - django-url-filter==0.3.15 replaced with dj-url-filter==0.4.4.

File additions:
  - Created a requirements-test.txt file that contains all dependencies required for testing.
Fixes unioslo#487 by implementing option 5 in the issue.

Supports: python3.7+, django 3.2+. Tests included for this range.
Breaking changes: None

This implementation uses django-filter as intended. It sets a default filter backend and uses standard filter_class models where possible.

Exceptions take place in the following views:
  - HostList. Relies on manipulating the queryset, and said manipulation is also used in the filter-less HostDetail.
  - *Zone*List. The abstraction model for these views is based around propagating a filterset into the parent class.

Concerns:
  - This patch creates explicit mapping filters for JSONField and CIDRField. It is unclear how well-tested these are.
@terjekv terjekv changed the title Migrate-to-django-filter Django 4 support: Option 5, migrating to django-filter Mar 29, 2023
@terjekv terjekv marked this pull request as ready for review March 29, 2023 05:38
@terjekv
Copy link
Collaborator Author

terjekv commented Mar 29, 2023

Doing a close / reopen to see if tests will run.

@terjekv
Copy link
Collaborator Author

terjekv commented Mar 29, 2023

Superseded by #492.

@terjekv terjekv closed this Mar 29, 2023
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.

Support for Django4.
1 participant