magic-removal: Merged to [2392]

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-02-25 17:37:58 +00:00
parent cab51971ac
commit 52f84c0f63
2 changed files with 6 additions and 7 deletions

View File

@ -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?

View File

@ -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'