Просмотр исходного кода

Closes #14035: Order global search results of equivalent weight by value (#14140)

Jeremy Stretch 2 лет назад
Родитель
Сommit
c2d1988cb3

+ 17 - 0
netbox/extras/migrations/0099_cachedvalue_ordering.py

@@ -0,0 +1,17 @@
+# Generated by Django 4.2.6 on 2023-10-30 14:04
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('extras', '0098_webhook_custom_field_data_webhook_tags'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='cachedvalue',
+            options={'ordering': ('weight', 'object_type', 'value', 'object_id')},
+        ),
+    ]

+ 1 - 1
netbox/extras/models/search.py

@@ -50,7 +50,7 @@ class CachedValue(models.Model):
     )
 
     class Meta:
-        ordering = ('weight', 'object_type', 'object_id')
+        ordering = ('weight', 'object_type', 'value', 'object_id')
         verbose_name = _('cached value')
         verbose_name_plural = _('cached values')