Skip to content

Commit 684063b

Browse files
authored
Resolve warning of inconsistent result when call LabResults view (#959)
As LabResults is used in a test with pagination, a default ordering is required to omit warning about unpredictable order.
1 parent cb023fc commit 684063b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 3.0.9 on 2021-07-14 08:09
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("example", "0009_labresults_author"),
10+
]
11+
12+
operations = [
13+
migrations.AlterModelOptions(
14+
name="labresults",
15+
options={"ordering": ("id",)},
16+
),
17+
]

example/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ class LabResults(models.Model):
169169
related_name="lab_results",
170170
)
171171

172+
class Meta:
173+
ordering = ("id",)
174+
172175

173176
class Company(models.Model):
174177
name = models.CharField(max_length=100)

0 commit comments

Comments
 (0)