-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fixes #19800: ModuleType import supports associating ModuleTypeProfile #19803
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 #19800: ModuleType import supports associating ModuleTypeProfile #19803
Conversation
Also includes an additional regression assertion.
netbox/dcim/tests/test_views.py
Outdated
| InterfaceTemplate, FrontPortTemplate, RearPortTemplate, ModuleBayTemplate, | ||
| ] | ||
| for model in additional_permissions: | ||
| obj_perm.object_types.add(ObjectType.objects.get_for_model(model)) |
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.
Open to suggestions on this approach.
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.
There's an add_permissions() method on the test case to facilitate this; will that work?
netbox/dcim/tests/test_views.py
Outdated
| InterfaceTemplate, FrontPortTemplate, RearPortTemplate, ModuleBayTemplate, | ||
| ] | ||
| for model in additional_permissions: | ||
| obj_perm.object_types.add(ObjectType.objects.get_for_model(model)) |
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.
There's an add_permissions() method on the test case to facilitate this; will that work?
netbox/dcim/forms/bulk_import.py
Outdated
| fields = [ | ||
| 'manufacturer', 'model', 'part_number', 'description', 'airflow', 'weight', 'weight_unit', 'comments', | ||
| 'tags', | ||
| 'tags', 'profile', |
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.
Could you move profile before comments in the list? It affects the ordering of the fields in the import form.
I ultimately left the extra asserts in for test_bulk_import_objects_with_permissionsince since the parent test is currently only testing against number of objects successfully imported. Will file a follow up FR to improve that test.
Fixes: #19800
profileto the list of fields the import form should recognizeBulkImportObjectsViewTestCase