Ticket #11392: result_set_ordering.diff
File result_set_ordering.diff, 3.6 KB (added by , 15 years ago) |
---|
-
modeltests/transactions/models.py
50 50 Exception: I meant to do that 51 51 52 52 # Same behavior as before 53 >>> Reporter.objects. all()53 >>> Reporter.objects.order_by('id') 54 54 [<Reporter: Alice Smith>, <Reporter: Ben Jones>] 55 55 56 56 # With the commit_on_success decorator, the transaction is only comitted if the … … 62 62 Exception: I meant to do that 63 63 64 64 # This time the object never got saved 65 >>> Reporter.objects. all()65 >>> Reporter.objects.order_by('id') 66 66 [<Reporter: Alice Smith>, <Reporter: Ben Jones>] 67 67 68 68 # If there aren't any exceptions, the data will get saved … … 83 83 ... transaction.commit() 84 84 >>> manually_managed = transaction.commit_manually(manually_managed) 85 85 >>> manually_managed() 86 >>> Reporter.objects. all()86 >>> Reporter.objects.order_by('id') 87 87 [<Reporter: Ben Jones>, <Reporter: Carol Doe>] 88 88 89 89 # If you forget, you'll get bad errors -
regressiontests/null_fk/models.py
44 44 >>> print c.post 45 45 None 46 46 47 >>> comments = Comment.objects.select_related('post__forum__system_info'). all()47 >>> comments = Comment.objects.select_related('post__forum__system_info').order_by('id') 48 48 >>> [(c.id, c.comment_text, c.post) for c in comments] 49 49 [(1, u'My first comment', <Post: First Post>), (2, u'My second comment', None)] 50 50 -
regressiontests/serializers_regress/tests.py
103 103 def generic_compare(testcase, pk, klass, data): 104 104 instance = klass.objects.get(id=pk) 105 105 testcase.assertEqual(data[0], instance.data) 106 testcase.assertEqual(data[1:], [t.data for t in instance.tags. all()])106 testcase.assertEqual(data[1:], [t.data for t in instance.tags.order_by('id')]) 107 107 108 108 def fk_compare(testcase, pk, klass, data): 109 109 instance = klass.objects.get(id=pk) … … 111 111 112 112 def m2m_compare(testcase, pk, klass, data): 113 113 instance = klass.objects.get(id=pk) 114 testcase.assertEqual(data, [obj.id for obj in instance.data. all()])114 testcase.assertEqual(data, [obj.id for obj in instance.data.order_by('id')]) 115 115 116 116 def im2m_compare(testcase, pk, klass, data): 117 117 instance = klass.objects.get(id=pk) -
regressiontests/aggregation_regress/models.py
264 264 [<Book: Artificial Intelligence: A Modern Approach>, <Book: Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp>, <Book: Practical Django Projects>, <Book: Python Web Development with Django>, <Book: Sams Teach Yourself Django in 24 Hours>, <Book: The Definitive Guide to Django: Web Development Done Right>] 265 265 266 266 # Regression for #10248 - Annotations work with DateQuerySets 267 >>> Book.objects.annotate(num_authors=Count('authors')).filter(num_authors=2).dates('pubdate', 'day')267 >>> sorted(Book.objects.annotate(num_authors=Count('authors')).filter(num_authors=2).dates('pubdate', 'day')) 268 268 [datetime.datetime(1995, 1, 15, 0, 0), datetime.datetime(2007, 12, 6, 0, 0)] 269 269 270 270 # Regression for #10290 - extra selects with parameters can be used for