Commit Graph

233 Commits

Author SHA1 Message Date
Andrei Antoukh 99321e30ce Fixed #18306 -- Made deferred models issue update_fields on save
Deferred models now automatically update only the fields which are
loaded from the db (with .only() or .defer()). In addition, any field
set manually after the load is updated on save.
2012-08-12 22:39:27 +03:00
James Bennett 7731cc8689 Fix #18062: Document best practices for choices in model fields. 2012-08-08 12:49:28 -04:00
Aymeric Augustin c5ef65bcf3 [py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under
  Python 2 for backwards compatibility).
* Renamed smart_str to smart_bytes.
* Re-introduced smart_str as an alias for smart_text under Python 3
  and smart_bytes under Python 2 (which is backwards compatible).
  Thus smart_str always returns a str objects.
* Used the new smart_str in a few places where both Python 2 and 3
  want a str.
2012-08-07 12:00:22 +02:00
Tim Graham b496be331c Fixed #15932 - Documented how to supress multiple reverse relations to the same model.
Thanks Claude Paroz for the patch.
2012-08-03 16:27:45 -04:00
Ramiro Morales 50837434db Clarified default name of M2M relationship DB table. 2012-07-24 22:44:28 -03:00
Anssi Kääriäinen 29132ebdef Fixed #17788 -- Added batch_size argument to qs.bulk_create()
The qs.bulk_create() method did not work with large batches together
with SQLite3. This commit adds a way to split the bulk into smaller
batches. The default batch size is unlimited except for SQLite3 where
the batch size is limited to 999 SQL parameters per batch.

Thanks to everybody who participated in the discussions at Trac.
2012-07-17 15:24:41 +03:00
Aymeric Augustin bbc590697a Removed Django 1.0-specific sections. 2012-07-07 16:44:55 +02:00
Tim Graham 7313468f85 Fixed #17436 - Added warning about overriding Model.__init__()
Thanks zsiciarz for the draft patch.
2012-07-01 18:04:16 -04:00
Raúl Cumplido 55ffcf8e7b Fixed #18145 -- Improved documentation of unique_together type fields 2012-06-30 17:16:40 -04:00
Anssi Kääriäinen b6c356b7bb Fixed #17485 -- Made defer work with select_related
This commit tackles a couple of issues. First, in certain cases there
were some mixups if field.attname or field.name should be deferred.
Field.attname is now always used.

Another issue tackled is a case where field is both deferred by
.only(), and selected by select_related. This case is now an error.

A lot of thanks to koniiiik (Michal Petrucha) for the patch, and
to Andrei Antoukh for review.
2012-06-26 18:08:42 +03:00
Aymeric Augustin c28e700c7e Removed references to changes made in 1.2.
Thanks Florian Apolloner for the patch.
2012-06-07 15:02:35 +02:00
Jacob Kaplan-Moss 7edf231d46 Replaced documentation snippets using "gender" with less sensitive examples. 2012-06-06 13:52:53 +02:00
Aymeric Augustin 29a80354ab Added alt attribute to img tags in docs.
This is a good practice for accessibility.
Thanks Jessica McKellar for the report.
2012-06-06 10:32:03 +02:00
Andrei Antoukh 365853da01 Fixed #4102 -- Allow update of specific fields in model.save()
Added the ability to update only part of the model's fields in
model.save() by introducing a new kwarg "update_fields". Thanks
to all the numerous reviewers and commenters in the ticket
2012-05-12 10:29:41 +03:00
Claude Paroz 596cb9c7e2 Replaced print statement by print function (forward compatibility syntax). 2012-04-30 20:45:03 +02:00
Claude Paroz 3904b74a3f Fixed #18013 -- Use the new 'as' syntax for exceptions.
Thanks Clueless for the initial patch.
Note that unittest has been purposely left out (external package only used by Python 2.6).
2012-04-29 20:57:15 +02:00
Anssi Kääriäinen 584e2c0337 Prevent Oracle from changing field.null to True
Fixed #17957 -- when using Oracle and character fields, the fields
were set null = True to ease the handling of empty strings. This
caused problems when using multiple databases from different vendors,
or when the character field happened to be also a primary key.

The handling was changed so that NOT NULL is not emitted on Oracle
even if field.null = False, and field.null is not touched otherwise.

Thanks to bhuztez for the report, ramiro for triaging & comments,
ikelly for the patch and alex for reviewing.
2012-04-29 19:25:46 +03:00
Alex Gaynor 3c5ff9d703 Fixed #5893 -- Added a flag to FilePathField to allow listing folders, in addition to regular files. Thank you to Brian Rosner, for encouraging me to first contribute to Django 4 years ago.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17925 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-22 14:44:08 +00:00
Julien Phalip 93d1fdb130 Fixed #17877 -- Ensured that extra WHERE clauses get correctly ANDed when they contain OR operations. Thanks to Marek Brzóska for the report, to eleather for the test case and to Adrien Lemaire for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17880 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-09 00:43:08 +00:00
Aymeric Augustin 9ed6e08ff9 Removed deprecated URLField.verify_exists.
The deprecation schedule was slightly accelerated because of possible security ramifications.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@17847 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-31 13:55:03 +00:00
Claude Paroz 31e84e40f8 Fixed #17870 -- Documented that EmailField default max_length of 75 does not comply with RFCs 3696/5321. Thanks Rotund for the report and the patch and Russell Keith-Magee for the review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17826 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-29 18:39:21 +00:00
Claude Paroz f13328f776 Fixed #17926 -- Removed mention of XMLField in docs (missing deletion from r15982). Thanks aburgel for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17764 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-17 22:13:20 +00:00
Adrian Holovaty dd246a62c7 Edited some docs and docstrings until [17685]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17686 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-12 20:05:48 +00:00
Aymeric Augustin e1a31aadb0 Fixed an inappropriate repetition. Thanks DanGer for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17679 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-11 11:49:38 +00:00
Aymeric Augustin cfd0cd1bc9 Documented a limit of the SQLite backend, in relation with the bulk_create function. Refs #17788.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17653 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-04 17:34:22 +00:00
Luke Plant de9942a667 Fixed #17668 - prefetch_related does not work in in_bulk
Thanks to gurets for the report, and akaariai for the initial patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-28 19:34:04 +00:00
Aymeric Augustin 5b560ec0c0 Fixed a few typos in the aggregation functions reference.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17569 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-21 18:28:35 +00:00
Adrian Holovaty ead8a869ce Edited models/options.txt changes from [17314]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17420 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-03 17:45:28 +00:00
Aymeric Augustin f0d4676750 Fixed #10139 -- Clarified that slicing an evaluated QuerySet returns a list, not a QuerySet. Thanks ori for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17383 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-21 15:32:52 +00:00
Ramiro Morales 33f839b252 Moved misplaced documentation warning note about internal QuerySet query atribute.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17342 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-06 17:15:15 +00:00
Timo Graham 72793766a7 Fixed #640 - Documented that changing order_with_respect_to requires a schema change; thanks fcurella and poirier for the draft patches.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17316 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-31 15:30:22 +00:00
Timo Graham 060783d52d Fixed #702 - Documented that ManyToMany fields can't be in unique_together; thanks poirier for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17314 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-31 00:43:11 +00:00
Adrian Holovaty d3ef13044e Edited doc changes from [17244]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17302 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-30 18:01:34 +00:00
Ramiro Morales 287565779d Added support for modifying the effect of ``DISTINCT`` clauses so they
only consider some fields (PostgreSQL only).

For this, the ``distinct()`` QuerySet method now accepts an optional
list of model fields names and generates ``DISTINCT ON`` clauses on
these cases. Thanks Jeffrey Gelens and Anssi Kääriäinen for their work.

Fixes #6422.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 20:42:40 +00:00
Aymeric Augustin 295fd50752 Fixed a typo in the model fields reference.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17238 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-20 17:03:13 +00:00
Luke Plant e954a03871 Added warning about the performance of large IN clauses in prefetch_related docs
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17147 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-24 17:18:56 +00:00
Julien Phalip aa5230c4be Fixed #17269 -- Corrected the model options doc to indicate that, since 1.4, all fields in `Meta.ordering` are honored by the admin. Thanks to sebastian for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17130 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-21 06:07:24 +00:00
Karen Tracey c8c71057aa Fix #15646: Document that a FileField's full path can't be relied upon until its model has been saved to the database. Thanks poirier.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17113 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-19 15:08:07 +00:00
Aymeric Augustin 9b1cb755a2 Added support for time zones. Thanks Luke Plant for the review. Fixed #2626.
For more information on this project, see this thread:
http://groups.google.com/group/django-developers/browse_thread/thread/cf0423bbb85b1bbf



git-svn-id: http://code.djangoproject.com/svn/django/trunk@17106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-18 13:01:06 +00:00
Karen Tracey efe4e2e517 Fix #16570: Restore ability to have decimal fields where max_digits equals decimal_places. Thanks dcwatson and kenth.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-12 19:53:56 +00:00
Ramiro Morales 576e681302 Fixed #17063 -- Fixed visibility of a few version-dependant notes in our documentation.
Thanks jifeng.yin AT gmail DOT com for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17057 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-30 12:59:59 +00:00
Aymeric Augustin 246580573d Fixed #12308 -- Added tablespace support to the PostgreSQL backend.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16987 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-14 21:49:43 +00:00
Luke Plant d1e5c55258 Fixed many more ReST indentation errors, somehow accidentally missed from [16955]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-14 00:12:01 +00:00
Julien Phalip 406f9d1fa0 Fixed #7609 -- Noted in the model fields reference documentation that `PositiveIntegerField` accepts the value 0 for backwards-compatibility reasons. Thanks to everyone involved in the resolution of this issue, including Paul Collins for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16972 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-13 12:23:58 +00:00
Gabriel Hurley a71bd3e0c9 Corrected a reST formatting problem in the queryset reference docs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16958 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-11 18:23:08 +00:00
Luke Plant c61987d75a Removed use of non-standard indentation rules in docs, and the custom transform that supported them.
Doc writers should be aware that we are now back to normal ReST rules
regarding blockquotes.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16955 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-10 17:32:33 +00:00
Luke Plant af244e47cc Fixed a bunch of ReST errors that resulted in interpretation as block quotations
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-10 15:32:01 +00:00
Luke Plant ac6361a3a6 Fixed some ReST errors in docs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16945 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-08 18:07:30 +00:00
Luke Plant 052a011ee6 Fixed #17003 - prefetch_related should support foreign keys/one-to-one
Support for `GenericForeignKey` is also included.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16939 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-07 16:05:53 +00:00
Luke Plant 662eea116f Fixed #16937 - added `QuerySet.prefetch_related` to prefetch many related objects.
Many thanks to akaariai for lots of review and feedback, bug finding,
additional unit tests and performance testing.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16930 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-05 23:14:52 +00:00