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

Fixes #4988: Fix ordering of rack reservations with identical creation times

Jeremy Stretch 5 лет назад
Родитель
Сommit
5da7590eea

+ 1 - 0
docs/release-notes/version-2.9.md

@@ -4,6 +4,7 @@
 
 ### Bug Fixes
 
+* [#4988](https://github.com/netbox-community/netbox/issues/4988) - Fix ordering of rack reservations with identical creation times
 * [#5035](https://github.com/netbox-community/netbox/issues/5035) - Fix exception when modifying an IP address assigned to a VM
 * [#5038](https://github.com/netbox-community/netbox/issues/5038) - Fix validation of primary IPs assigned to virtual machines
 * [#5040](https://github.com/netbox-community/netbox/issues/5040) - Limit SLAAC status to IPv6 addresses

+ 17 - 0
netbox/dcim/migrations/0115_rackreservation_order.py

@@ -0,0 +1,17 @@
+# Generated by Django 3.1 on 2020-08-24 16:03
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('dcim', '0114_update_jsonfield'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='rackreservation',
+            options={'ordering': ['created', 'pk']},
+        ),
+    ]

+ 1 - 1
netbox/dcim/models/racks.py

@@ -600,7 +600,7 @@ class RackReservation(ChangeLoggedModel):
     csv_headers = ['site', 'rack_group', 'rack', 'units', 'tenant', 'user', 'description']
 
     class Meta:
-        ordering = ['created']
+        ordering = ['created', 'pk']
 
     def __str__(self):
         return "Reservation for rack {}".format(self.rack)