diff --git a/tests/bug24004/__init__.py b/tests/bug24004/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/bug24004/admin.py b/tests/bug24004/admin.py
new file mode 100644
index 0000000..8c38f3f
-
|
+
|
|
| 1 | from django.contrib import admin |
| 2 | |
| 3 | # Register your models here. |
diff --git a/tests/bug24004/models.py b/tests/bug24004/models.py
new file mode 100644
index 0000000..c8960d3
-
|
+
|
|
| 1 | from django.db import models |
| 2 | from django.utils import timezone |
| 3 | |
| 4 | class Page(models.Model): |
| 5 | date_modified = models.DateTimeField(default=timezone.now) |
| 6 | |
| 7 | class Meta: |
| 8 | get_latest_by = 'date_modified' |
diff --git a/tests/bug24004/tests.py b/tests/bug24004/tests.py
new file mode 100644
index 0000000..782d37c
-
|
+
|
|
| 1 | from django.test import TestCase |
| 2 | |
| 3 | from .models import Page |
| 4 | |
| 5 | class Issue24004TestCase(TestCase): |
| 6 | def test_repro(self): |
| 7 | page = Page.objects.create() |
| 8 | self.assertEqual(page, Page.objects.only('date_modified').latest()) |
diff --git a/tests/bug24004/views.py b/tests/bug24004/views.py
new file mode 100644
index 0000000..91ea44a
-
|
+
|
|
| 1 | from django.shortcuts import render |
| 2 | |
| 3 | # Create your views here. |