From 52f84c0f63fc2b7783721f2b27e6c0d5f0b584ce Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sat, 25 Feb 2006 17:37:58 +0000 Subject: [PATCH] magic-removal: Merged to [2392] git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2393 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/query.py | 9 ++++++--- tests/othertests/defaultfilters.py | 4 ---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/django/db/models/query.py b/django/db/models/query.py index 64c01336be..9c4a83f0c3 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -163,7 +163,10 @@ class QuerySet(object): def get(self, *args, **kwargs): "Performs the SELECT and returns a single object matching the given keyword arguments." - obj_list = list(self.filter(*args, **kwargs)) + clone = self.filter(*args, **kwargs) + if not clone._order_by: + clone._order_by = () + obj_list = list(clone) if len(obj_list) < 1: raise self.model.DoesNotExist, "%s does not exist for %s" % (self.model._meta.object_name, kwargs) assert len(obj_list) == 1, "get() returned more than one %s -- it returned %s! Lookup parameters were %s" % (self.model._meta.object_name, len(obj_list), kwargs) @@ -650,7 +653,7 @@ def lookup_inner(path, clause, value, opts, table, column): intermediate_table = field.m2m_db_table() join_column = field.m2m_reverse_name() intermediate_column = field.m2m_column_name() - + raise FieldFound # Does the name belong to a reverse defined many-to-many field? @@ -667,7 +670,7 @@ def lookup_inner(path, clause, value, opts, table, column): intermediate_table = field.field.m2m_db_table() join_column = field.field.m2m_column_name() intermediate_column = field.field.m2m_reverse_name() - + raise FieldFound # Does the name belong to a one-to-many field? diff --git a/tests/othertests/defaultfilters.py b/tests/othertests/defaultfilters.py index 626093837b..9be9c61601 100644 --- a/tests/othertests/defaultfilters.py +++ b/tests/othertests/defaultfilters.py @@ -237,10 +237,6 @@ False >>> timesince(datetime.datetime.now() - datetime.timedelta(1)) '1 day' -# datetime.date compataibility with timesince ->>> timesince(datetime.date.today() - datetime.timedelta(1)) -'1 day, 23 hours' - >>> default("val", "default") 'val'