Ticket #7957: reproduce_extra_problem.py

File reproduce_extra_problem.py, 801 bytes (added by Matthijs, 16 years ago)

file that demonstrated bug

Line 
1from django.core.management import setup_environ
2import settings
3setup_environ(settings)
4
5from django.contrib.auth.models import User
6
7for result in User.objects.extra(select=
8 {'foo3': "SELECT COUNT(auth_user.id) FROM auth_user WHERE (auth_user.username = %s)"}
9 , select_params=['root']).extra(select=
10 {'foo2': "SELECT COUNT(auth_user.id) FROM auth_user WHERE (auth_user.id = %s)"}
11 , select_params=['1']):
12 print result.foo3
13for result in User.objects.extra(select=
14 {'foo1': "SELECT COUNT(auth_user.id) FROM auth_user WHERE (auth_user.username = %s)"}
15 , select_params=['root']).extra(select=
16 {'foo2': "SELECT COUNT(auth_user.id) FROM auth_user WHERE (auth_user.id = %s)"}
17 , select_params=['1']):
18 print result.foo1
Back to Top