-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
DRAFT: 12552 replace mptt #12718
DRAFT: 12552 replace mptt #12718
Conversation
netbox/dcim/migrations/0174_remove_inventoryitem_level_remove_inventoryitem_lft_and_more.py
Outdated
Show resolved
Hide resolved
netbox/tenancy/migrations/0011_remove_contactgroup_level_remove_contactgroup_lft_and_more.py
Outdated
Show resolved
Hide resolved
netbox/wireless/migrations/0009_remove_wirelesslangroup_level_and_more.py
Outdated
Show resolved
Hide resolved
@@ -1136,7 +1128,7 @@ class InventoryItem(MPTTModel, ComponentModel): | |||
clone_fields = ('device', 'parent', 'role', 'manufacturer', 'part_id',) | |||
|
|||
class Meta: | |||
ordering = ('device__id', 'parent__id', '_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.
We can't arbitrarily drop ordering by parent Device, as it has ramifications unrelated to the tree hierarchy; for example, the order of results returned by the REST API endpoint.
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.
@jeremystretch can you provide the repo scenarios that this would effect? CTE can only order on a single field (technical limitation) if we need to do two I'm not sure how to work around that.
@@ -866,7 +866,7 @@ def save(self, *args, **kwargs): | |||
self._instantiate_components(self.device_type.frontporttemplates.all()) | |||
self._instantiate_components(self.device_type.modulebaytemplates.all()) | |||
self._instantiate_components(self.device_type.devicebaytemplates.all()) | |||
# Disable bulk_create to accommodate MPTT | |||
# Disable bulk_create to accommodate django-tree-queries |
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.
Is this actually necessary anymore? We had to avoid bulk creations with MPTT because the tree fields in the database needed to be recomputed, but that doesn't apply to CTE.
I might be missing something, but it seems like there are some pieces still missing from the implementation. Some observations, using the Region model as an example:
|
Sorting tables does seem to be broken, checking... |
@arthanson given the limitations of the CTE approach we discussed, can this be closed out? |
Fixes: #12552