1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

12552 test fixes

This commit is contained in:
Arthur
2023-05-19 09:40:13 -07:00
parent c93b7cfc5c
commit 71a74e410d
9 changed files with 19 additions and 8 deletions

View File

@ -149,4 +149,12 @@ class Migration(migrations.Migration):
name='inventoryitem',
options={'ordering': ('_name',)},
),
migrations.AlterModelOptions(
name='inventoryitemtemplate',
options={'ordering': ('_name',)},
),
migrations.AlterModelOptions(
name='location',
options={'ordering': ('name',)},
),
]

View File

@ -663,7 +663,7 @@ class InventoryItemTemplate(TreeNode, ComponentTemplateModel):
component_model = InventoryItem
class Meta:
ordering = ('device_type__id', 'parent__id', '_name')
ordering = ('_name', )
constraints = (
models.UniqueConstraint(
fields=('device_type', 'parent', 'name'),

View File

@ -1128,7 +1128,6 @@ class InventoryItem(TreeNode, ComponentModel):
clone_fields = ('device', 'parent', 'role', 'manufacturer', 'part_id',)
class Meta:
# ordering = ('device__id', 'parent__id', '_name')
ordering = ('_name', )
constraints = (
models.UniqueConstraint(

View File

@ -294,7 +294,7 @@ class Location(NestedGroupModel):
)
class Meta:
ordering = ['site', 'name']
ordering = ('name', )
constraints = (
models.UniqueConstraint(
fields=('site', 'parent', 'name'),

View File

@ -857,7 +857,7 @@ class InventoryItemTable(DeviceComponentTable):
class DeviceInventoryItemTable(InventoryItemTable):
name = tables.TemplateColumn(
template_code='<a href="{{ record.get_absolute_url }}" style="padding-left: {{ record.level }}0px">'
template_code='<a href="{{ record.get_absolute_url }}" style="padding-left: {{ record.tree_depth }}0px">'
'{{ value }}</a>',
order_by=Accessor('_name'),
attrs={'td': {'class': 'text-nowrap'}}

View File

@ -145,7 +145,7 @@
{% for location in locations %}
<tr>
<td>
{% for i in location.level|as_range %}<i class="mdi mdi-circle-small"></i>{% endfor %}
{% for i in location.tree_depth|as_range %}<i class="mdi mdi-circle-small"></i>{% endfor %}
{{ location|linkify }}
</td>
<td>

View File

@ -155,8 +155,8 @@ def serialize_object(obj, resolve_tags=True, extra=None):
# Exclude any TreeNode fields
if issubclass(obj.__class__, TreeNode):
for field in ['level', 'lft', 'rght', 'tree_id']:
data.pop(field)
for field in ['tree_depth', 'tree_path', 'tree_ordering']:
data.pop(field, None)
# Include custom_field_data as "custom_fields"
if hasattr(obj, 'custom_field_data'):

View File

@ -37,4 +37,8 @@ class Migration(migrations.Migration):
to='wireless.wirelesslangroup',
),
),
migrations.AlterModelOptions(
name='wirelesslangroup',
options={'ordering': ('name',), 'verbose_name': 'Wireless LAN Group'},
),
]

View File

@ -54,7 +54,7 @@ class WirelessLANGroup(NestedGroupModel):
)
class Meta:
ordering = ('name', 'pk')
ordering = ('name', )
constraints = (
models.UniqueConstraint(
fields=('parent', 'name'),