1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

newforms-admin: Merged from trunk up to [7526].

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7533 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Brian Rosner
2008-05-14 05:48:44 +00:00
parent 4e5681caf3
commit 13ae9e484d
8 changed files with 51 additions and 41 deletions

View File

@@ -398,4 +398,16 @@ u'\u6797\u539f \u3081\u3050\u307f'
>>> s = set([a10, a11, a12])
>>> Article.objects.get(headline='Article 11') in s
True
# The 'select' argument to extra() supports names with dashes in them, as long
# as you use values().
>>> Article.objects.filter(pub_date__year=2008).extra(select={'dashed-value': '1'}).values('headline', 'dashed-value')
[{'headline': u'Article 11', 'dashed-value': 1}, {'headline': u'Article 12', 'dashed-value': 1}]
# If you use 'select' with extra() and names containing dashes on a query
# that's *not* a values() query, those extra 'select' values will silently be
# ignored.
>>> articles = Article.objects.filter(pub_date__year=2008).extra(select={'dashed-value': '1', 'undashedvalue': '2'})
>>> articles[0].undashedvalue
2
"""