Changeset 7480 for django/trunk/docs/db-api.txt
- Timestamp:
- 04/27/08 06:55:47 (9 months ago)
- Files:
-
- django/trunk/docs/db-api.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/docs/db-api.txt
r7477 r7480 393 393 394 394 You can also slice from the item ''N'' to the end of the queryset. For 395 example, to return everything from the fixth item onwards::395 example, to return everything from the sixth item onwards:: 396 396 397 397 Entry.objects.all()[5:] … … 571 571 Any fields used in an ``order_by()`` call are included in the SQL 572 572 ``SELECT`` columns. This can sometimes lead to unexpected results when 573 used in conjun tion with ``distinct()``. If you order by fields from a573 used in conjunction with ``distinct()``. If you order by fields from a 574 574 related model, those fields will be added to the selected columns and they 575 575 may make otherwise duplicate rows appear to be distinct. Since the extra … … 684 684 item is the first field, etc. For example:: 685 685 686 >>> Entry.objects.values_list('id', 'headlin g')686 >>> Entry.objects.values_list('id', 'headline') 687 687 [(1, u'First entry'), ...] 688 688 … … 838 838 this for models that are more than one relation away by separating the field 839 839 names with double underscores, just as for filters. For example, if we have 840 this emodel::840 this model:: 841 841 842 842 class Room(models.Model): … … 2104 2104 a queryset. You can do this with the ``update()`` method. For example:: 2105 2105 2106 # Update all the headlin gs to the same value.2106 # Update all the headlines to the same value. 2107 2107 Entry.objects.all().update(headline='Everything is the same') 2108 2108
