Changes between Version 81 and Version 82 of RemovingTheMagic
- Timestamp:
- Feb 27, 2006, 4:58:19 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
RemovingTheMagic
v81 v82 355 355 * {{{all()}}} -- Returns a {{{QuerySet}}} of all objects in the database. This is like the old {{{get_list()}}}. Takes no arguments. 356 356 * {{{filter(**kwargs)}}} -- Returns a {{{QuerySet}}}, filtered by the given keyword arguments. Lookup arguments are in the same style as previously, e.g. {{{pubdate__year=2005}}}, except you can leave off {{{__exact}}} as a convenience. For example, {{{name='John'}}} and {{{name__exact='John'}}} are equivalent. 357 * {{{exclude(**kwargs)}}} is the same as {{{filter()}}}, but returns objects where the given arguments are not true. 357 358 * {{{order_by(*fieldnames)}}} -- Returns a {{{QuerySet}}} 358 359 * {{{count()}}} -- Returns the count of all objects in the database. … … 399 400 }}} 400 401 401 || '''Old syntax''' 402 || '''Old syntax''' || '''New syntax''' || 402 403 || {{{reporters.get_list()}}} || {{{Reporter.objects.all()}}} || 403 404 || {{{reporters.get_list(fname__exact='John')}}} || {{{Reporter.objects.filter(fname='John')}}} || … … 406 407 || {{{reporters.get_object(pk=3)}}} || {{{Reporter.objects.get(pk=3)}}} || 407 408 || {{{reporters.get_object(fname__contains='John')}}} || {{{Reporter.objects.get(fname__contains='John')}}} || 409 || {{{reporters.get_list(fname__ne='John')}}} || {{{Reporter.objects.exclude(fname='John')}}} (note that {{{ne}}} is no longer a valid lookup type) || 410 || (not previously possible) || {{{Reporter.objects.exclude(fname__contains='n')}}} || 408 411 || {{{reporters.get_list(distinct=True)}}} || {{{Reporter.objects.distinct()}}} || 409 412 || {{{reporters.get_values()}}} || {{{Reporter.objects.values()}}} || 410 413 || {{{reporters.get_in_bulk([1, 2])}}} || {{{Reporter.objects.in_bulk([1, 2])}}} || 411 414 || {{{reporters.get_in_bulk([1, 2], fname__exact='John')}}} || {{{Reporter.objects.filter(fname='John').in_bulk([1, 2])}}} || 412 || '''Date lookup''' || ||413 || {{{articles.get_pub_date_list('year')}}} 414 || '''Latest-object lookup''' || ||415 || '''Date lookup''' || || 416 || {{{articles.get_pub_date_list('year')}}} || {{{Article.objects.dates('pub_date', 'year')}}} || 417 || '''Latest-object lookup''' || || 415 418 || {{{articles.get_latest()}}} (required {{{get_latest_by}}} in model) || {{{Article.objects.latest()}}} (with {{{get_latest_by}}} in model) || 416 419 || (Not previously possible) || {{{Article.objects.latest('pub_date')}}} # Latest by pub_date (overrides {{{get_latest_by}}} field in model) ||