Ticket #24004: testcase_repro_24004.diff

File testcase_repro_24004.diff, 1.3 KB (added by Baptiste Mispelon, 10 years ago)
  • new file tests/bug24004/admin.py

    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
    - +  
     1from django.contrib import admin
     2
     3# Register your models here.
  • new file tests/bug24004/models.py

    diff --git a/tests/bug24004/models.py b/tests/bug24004/models.py
    new file mode 100644
    index 0000000..c8960d3
    - +  
     1from django.db import models
     2from django.utils import timezone
     3
     4class Page(models.Model):
     5    date_modified = models.DateTimeField(default=timezone.now)
     6
     7    class Meta:
     8        get_latest_by = 'date_modified'
  • new file tests/bug24004/tests.py

    diff --git a/tests/bug24004/tests.py b/tests/bug24004/tests.py
    new file mode 100644
    index 0000000..782d37c
    - +  
     1from django.test import TestCase
     2
     3from .models import Page
     4
     5class Issue24004TestCase(TestCase):
     6    def test_repro(self):
     7        page = Page.objects.create()
     8        self.assertEqual(page, Page.objects.only('date_modified').latest())
  • new file tests/bug24004/views.py

    diff --git a/tests/bug24004/views.py b/tests/bug24004/views.py
    new file mode 100644
    index 0000000..91ea44a
    - +  
     1from django.shortcuts import render
     2
     3# Create your views here.
Back to Top