﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30901	first() and last() return same object (first in both cases) when the order_by field is the same	Tadas	nobody	"{{{
from django.db import models
from django.utils import timezone

class TestModel(models.Model):
    name = models.IntegerField()
    created = models.DateTimeField()


dt = timezone.now()
for i in range(5):
    TestModel(
        name=str(i),
        created=dt
    ).save()

obj = TestModel.objects.all().order_by('created')

print(obj.first().name)
print(obj.last().name)
}}}

Both print statements above will print 0
"	Bug	closed	Uncategorized	2.2	Normal	invalid		Tadas	Unreviewed	0	0	0	0	0	0
