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

17929 Add Scope Mixins to Prefix #17930

Merged
merged 14 commits into from
Nov 15, 2024
Merged

17929 Add Scope Mixins to Prefix #17930

merged 14 commits into from
Nov 15, 2024

Conversation

arthanson
Copy link
Collaborator

@arthanson arthanson commented Nov 4, 2024

Fixes: #17929

Had to move the filterset mixin to it's own file as there was a circular dependency - this requires updating previous imports that reference it.

Note: The mixin uses %(class)s for the related_name which resolves to "_prefixs" instead of "_prefixes" which isn't great, but it is an internal field that shouldn't really be references, so shouldn't be much of an issue.

@jeremystretch jeremystretch added this to the v4.2 milestone Nov 5, 2024
@arthanson arthanson changed the title DRAFT: 17929 Add Scope Mixins to Prefix 17929 Add Scope Mixins to Prefix Nov 7, 2024
@jeremystretch jeremystretch marked this pull request as ready for review November 7, 2024 17:07
@jeremystretch
Copy link
Member

jeremystretch commented Nov 14, 2024

Note: The mixin uses %(class)s for the related_name which resolves to "_prefixs" instead of "_prefixes" which isn't great, but it is an internal field that shouldn't really be references, so shouldn't be much of an issue.

IMO this is going to cause problems in the future, as we're forcing ourselves to accommodate what is essentially a typo. I propose adopting one of three options:

  1. Use Django's default related name convention (prefix_set).
  2. Drop the related name entirely for these fields.
  3. Override these fields for the Prefix model to declare related_name explicitly.

netbox/ipam/forms/model_forms.py Show resolved Hide resolved
netbox/dcim/filterset_mixins.py Outdated Show resolved Hide resolved
@jeremystretch jeremystretch merged commit 9fe6685 into feature Nov 15, 2024
6 checks passed
@jeremystretch jeremystretch deleted the 17929-prefix-scope branch November 15, 2024 19:55
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