Skip to content

Commit

Permalink
[soc2010/query-refactor] Fixed querying for objects by their related …
Browse files Browse the repository at this point in the history
…objects (by their primary keys).

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2010/query-refactor@13431 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
alex committed Jul 13, 2010
1 parent d83203c commit 536a5ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions django/contrib/mongodb/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
class DatabaseFeatures(object):
interprets_empty_strings_as_nulls = False
sql_nulls = False
related_fields_match_type = False


class DatabaseOperations(object):
Expand Down
3 changes: 3 additions & 0 deletions tests/regressiontests/mongodb/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ def test_foreignkey(self):
self.assertEqual(b.current_group_id, e.pk)
self.assertFalse(hasattr(b, "_current_group_cache"))
self.assertEqual(b.current_group, e)

self.assertEqual(Artist.objects.get(current_group=e), b)
self.assertEqual(Artist.objects.get(current_group__id=e.pk), b)

def test_exists(self):
self.assertFalse(Artist.objects.filter(name="Brian May").exists())
Expand Down

0 comments on commit 536a5ca

Please sign in to comment.