-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
base: main
Are you sure you want to change the base?
Conversation
Also includes an additional regression assertion.
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?
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?
fan_module_type = ModuleType.objects.get(part_number='generic-fan') | ||
fan_module_type_profile = ModuleTypeProfile.objects.get(name='Fan') | ||
|
||
assert fan_module_type.profile == fan_module_type_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.
I don't think this is needed. The test should be checking that each declared field was set to the correct value on import.
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.
Copy, will verify. My memory was that it was just checking object count relative to pre-test.
@@ -471,7 +471,7 @@ class Meta: | |||
model = ModuleType | |||
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.
Fixes: #19800
profile
to the list of fields the import form should recognizeBulkImportObjectsViewTestCase