-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fixes: #18656 Unable to import IP Address and assign to FHRP Group #18950
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
Fixes: #18656 Unable to import IP Address and assign to FHRP Group #18950
Conversation
jnovinger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor change requested, plus please add this new import field to cls.csv_data for the tests in ipam.tests.test_view.py::IPAddressTestCase.setUpTestData.
| label=_('FHRP Group'), | ||
| queryset=FHRPGroup.objects.all(), | ||
| required=False, | ||
| to_field_name='name', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with your choice to use name. This will require users to populated the name field for any FHRP Groups they want to assign, but that seems pretty reasonable.
I did some grep-ing through the code and it seems to_field_name='name' is almost universally the default, with only a couple of specific expections. If we need to add the ability to assign at import via FHRPGroup.group_id, that can definitely be a separate FR.
|
@jnovinger about the testing cases, I updated the |
jnovinger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @renatoalmeidaoliveira !
Fixes: #18656 Unable to import IP Address and assign to FHRP Group
fhrpgroupfield inIPAddressImportFormObservations:
Since FHRPGroup Model doesn't implement uniqueness method, choosing the appropriated accessor for the
fhrpgroupits a bit tricky.I choose
nameinstead of thegroup_idbeacuse, IMO,group_idis more likely to get repeated, but maybe a more accurate approach could be open a new Issue to setup some uniqueness criteria for FHRPGroup, make the import form following that pattern.