Commit Graph

371 Commits

Author SHA1 Message Date
Claude Paroz 7442eb1a24 Fixed #20224 -- Update docs examples which mention __unicode__
Thanks Marc Tamlyn and Tim Graham for the review.
2013-07-05 19:27:07 +02:00
Tim Graham 577b0f9189 Fixed #20561 -- Emphasized that QuerySet.distinct([*fields]) is only supported by Postgres.
Thanks jtiai for the suggestion.
2013-07-05 07:20:37 -04:00
Tim Graham 428de2e339 Fixed #12579 -- Noted QuerySet.get_or_create() depends on database unique constraints.
Thanks timmolendijk, jdunck, vijay_shanker, and loic84.
2013-07-04 07:53:13 -04:00
Ramiro Morales 6ba69c8456 Removed 'depth' .select_related() argument as per deprecation TL. 2013-06-28 21:48:16 -03:00
Andrew Godwin 12cb0df10f Docs for related_query_name 2013-06-27 15:44:22 +01:00
James Bennett ba610cb319 Fixed #19881 -- Documented that get_next/previous_by_FOO uses default manager. 2013-06-21 13:14:05 -04:00
Loic Bistuer ee77d4b253 Fixed #20199 -- Allow ModelForm fields to override error_messages from model fields 2013-06-18 08:01:17 -04:00
Tim Graham 5074c75a37 Fixed #16856 - Added a way to clear select_related.
Thanks Carl for the suggestion and David Cramer for the patch.
2013-05-30 11:06:05 -04:00
Tim Graham d321d1acf0 Fixed #20228 - Documented unique_for_date and exclude behavior.
Thanks Deepak Thukral for the patch.
2013-05-28 10:04:07 -04:00
Tim Graham 90af278203 Fixed #16137 - Removed kwargs requirement for QuerySet.get_or_create
Thanks wilfred@, poirier, and charettes for work
on the patch.
2013-05-27 10:01:14 -04:00
Baptiste Mispelon 08726cb013 Fix #20505: Typo in BinaryField documentation. 2013-05-27 11:35:34 +02:00
Selwin Ong 375e275030 Slightly reworded 'last()' docs. 2013-05-21 23:18:35 +07:00
Selwin Ong ea9a0857d4 Fixed #19326 -- Added first() and last() methods to QuerySet 2013-05-21 18:52:28 +03:00
Pablo Recio 65f9e0affd Fixes #18896. Add tests verifying that you can get IntegrityErrors using get_or_create through relations like M2M, and it also adds a note into the documentation warning about it 2013-05-19 14:16:12 +02:00
Marc Tamlyn 33c361ef9d Merge pull request #1129 from frog32/master
Add needed Imports to the Documentation
2013-05-19 01:37:25 -07:00
Marc Egli e4591debd1 Add missing imports and models to the examples in the the model layer documentation 2013-05-18 18:38:52 +02:00
Donald Stufft 398841d6d3 Merge branch 'allow-any-iterable-for-choices' 2013-05-18 11:31:16 -04:00
Erik Romijn 56e2f6ccae Fixed #20446 -- Documentation for SmallIntegerField does not clarify 'small' 2013-05-18 17:16:07 +02:00
Donald Stufft a19e9d80ff Fixed #20430 - Enable iterable of iterables for model choices
Allows for any iterable, not just lists or tuples, to be used as
the inner item for a list of choices in a model.
2013-05-18 11:14:05 -04:00
Aymeric Augustin 7b85ef9dfb Fixed #20408 -- Clarified that values_list() doesn't return a list.
Thanks marktranchant, bmispelon, and alextreme.
2013-05-18 12:46:12 +02:00
Tim Graham 8035533557 Merge pull request #1039 from cannona/master
Clarified what unique_for_date considers
2013-05-14 16:01:24 -07:00
Wilfred Hughes d258cce482 Fixing a minor spelling mistake in the queryset documentation 2013-05-14 11:40:33 +01:00
Simeon Visser b9efc03e6d Fixed #20397 - Cleaned up issue with quotation marks in documentation 2013-05-12 20:24:48 +01:00
Aymeric Augustin 1fff8daf88 Fixed test failures on MySQL.
Some tests failed when the time zone definitions were loaded in MySQL
and pytz wasn't installed. This setup isn't supported.
2013-05-08 13:03:36 +02:00
Aaron Cannon 291250f7b6 Added clarification to the docs, pointing out that unique_for_date only considers the date portion of DateTime fields. 2013-05-03 08:46:53 -05:00
Juan Catalano 78c842a323 Adapted uses of versionchanged/versionadded to the new form.
Refs #20104.
2013-04-20 17:18:35 +02:00
Tim Graham 712a792713 Fixed #20243 - Clarified when RelatedManager.remove() exists. 2013-04-11 14:13:09 -04:00
Andrew Badr 408da7b457 remove confusing phrase from DecimalField docs
The phrase "if it exists" was used in reference to the `decimal_places`
argument to `DecimalField`, when in fact that field is required.
2013-04-11 16:27:14 +03:00
Aymeric Augustin e16c48e001 Fixed #15124 -- Changed the default for BooleanField.
Thanks to the many contributors who updated and improved the patch over
the life of this ticket.
2013-03-24 13:47:01 +01:00
Tim Graham 93cffc3b37 Added missing markup to docs. 2013-03-22 13:50:07 -04:00
Aymeric Augustin 6197935152 Fixed #19968 -- Dropped support for PostgreSQL < 8.4. 2013-03-18 21:16:29 +01:00
Johan Charpentier 186bff4703 Fixed #20053 -- Fix `index_together` documentation 2013-03-15 15:15:52 +01:00
Anssi Kääriäinen 6b4834952d Fixed #16649 -- Refactored save_base logic
Model.save() will use UPDATE - if not updated - INSERT instead of
SELECT - if found UPDATE else INSERT. This should save a query when
updating, but will cost a little when inserting model with PK set.

Also fixed #17341 -- made sure .save() commits transactions only after
the whole model has been saved. This wasn't the case in model
inheritance situations.

The save_base implementation was refactored into multiple methods.
A typical chain for inherited save is:
save_base()
    _save_parents(self)
        for each parent:
            _save_parents(parent)
            _save_table(parent)
    _save_table(self)
2013-03-14 11:01:47 +02:00
Ramiro Morales 7e26f4cb79 Fixed broken link in binary fields doc. 2013-03-11 22:09:21 -03:00
Jonathan Loy b3c6a20e71 Fixed #20018: Added backtick to fix reference
Fixed #20018
2013-03-10 14:09:33 -04:00
Loic Bistuer 6983a1a540 Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
Alex Gaynor 1b81f328f4 Adde two "versionadded" markers, thanks to mYk for noticing. 2013-03-07 12:05:06 -08:00
Alex Gaynor bbbd698c7a Added a ManyToManyField(db_constraint=False) option, this allows not creating constraints on the intermediary models. 2013-03-07 11:24:51 -08:00
Claude Paroz 8ee1eddb7e Add a BinaryField model field
Thanks Michael Jung, Charl Botha and Florian Apolloner for review
and help on the patch.
2013-03-02 10:29:02 +01:00
Anssi Kääriäinen 50328f0a61 Fixed #19861 -- Transaction ._dirty flag improvement
There were a couple of errors in ._dirty flag handling:
  * It started as None, but was never reset to None.
  * The _dirty flag was sometimes used to indicate if the connection
    was inside transaction management, but this was not done
    consistently. This also meant the flag had three separate values.
  * The None value had a special meaning, causing for example inability
    to commit() on new connection unless enter/leave tx management was
    done.
  * The _dirty was tracking "connection in transaction" state, but only
    in managed transactions.
  * Some tests never reset the transaction state of the used connection.
  * And some additional less important changes.

This commit has some potential for regressions, but as the above list
shows, the current situation isn't perfect either.
2013-02-27 17:54:27 +02:00
Alex Gaynor 4e36e0a8b3 Clarified the language used in the documentation. Thanks to Mike Smith for the report. 2013-02-20 13:09:40 -08:00
Alex Gaynor b55cde054e Added a db_constraint option to ForeignKeys.
This controls whether or not a database level cosntraint is created. This is useful in a few specialized circumstances, but in general should not be used!
2013-02-20 11:27:32 -08:00
Tim Graham 218bbef0c4 Fixed #19824 - Corrected the class described for Field.primary_key from IntegerField to AutoField.
Thanks Keryn Knight.
2013-02-16 18:31:54 -05:00
Aymeric Augustin e74e207cce Fixed #17260 -- Added time zone aware aggregation and lookups.
Thanks Carl Meyer for the review.

Squashed commit of the following:

commit 4f290bdb60
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 13 21:21:30 2013 +0100

    Used '0:00' instead of 'UTC' which doesn't always exist in Oracle.

    Thanks Ian Kelly for the suggestion.

commit 01b6366f3c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 13 13:38:43 2013 +0100

    Made tzname a parameter of datetime_extract/trunc_sql.

    This is required to work around a bug in Oracle.

commit 924a144ef8
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Wed Feb 13 14:47:44 2013 +0100

    Added support for parameters in SELECT clauses.

commit b4351d2890
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 22:30:22 2013 +0100

    Documented backwards incompatibilities in the two previous commits.

commit 91ef84713c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 09:42:31 2013 +0100

    Used QuerySet.datetimes for the admin's date_hierarchy.

commit 0d0de288a5
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 09:29:38 2013 +0100

    Used QuerySet.datetimes in date-based generic views.

commit 9c0859ff7c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:43:25 2013 +0100

    Implemented QuerySet.datetimes on Oracle.

commit 68ab511a4f
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:43:14 2013 +0100

    Implemented QuerySet.datetimes on MySQL.

commit 22d52681d3
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:42:29 2013 +0100

    Implemented QuerySet.datetimes on SQLite.

commit f6800fd04c
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:43:03 2013 +0100

    Implemented QuerySet.datetimes on PostgreSQL.

commit 0c829c23f4
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:41:08 2013 +0100

    Added datetime-handling infrastructure in the ORM layers.

commit 104d82a777
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Mon Feb 11 10:05:55 2013 +0100

    Updated null_queries tests to avoid clashing with the __second lookup.

commit c01bbb3235
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 23:07:41 2013 +0100

    Updated tests of .dates().

    Replaced .dates() by .datetimes() for DateTimeFields.
    Replaced dates with datetimes in the expected output for DateFields.

commit 50fb7a5246
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 21:40:09 2013 +0100

    Updated and added tests for QuerySet.datetimes.

commit a8451a5004
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 22:34:46 2013 +0100

    Documented the new time lookups and updated the date lookups.

commit 29413eab2b
Author: Aymeric Augustin <aymeric.augustin@m4x.org>
Date:   Sun Feb 10 16:15:49 2013 +0100

    Documented QuerySet.datetimes and updated QuerySet.dates.
2013-02-16 09:19:04 +01:00
Anssi Kääriäinen f96c86b029 Added missing versionadded 1.6 to docs of earliest()
Refs #17813
2013-01-20 06:45:00 +02:00
Nick Sandford fe54377dae Fixed #17813 -- Added a .earliest() method to QuerySet
Thanks a lot to everybody participating in developing this feature.
The patch was developed by multiple people, at least Trac aliases
tonnzor, jimmysong, Fandekasp and slurms.

Stylistic changes added by committer.
2013-01-20 06:39:35 +02:00
Tim Graham 43f89e0ad6 Fixed #19605 - Removed unused url imports from doc examples.
Thanks sergzach for the suggestion.
2013-01-15 07:50:26 -05:00
Nick Sandford eb6c107624 Fixed #19360 -- Raised an explicit exception for aggregates on date/time fields in sqlite3
Thanks lsaffre for the report and Chris Medrela for the initial
patch.
2013-01-11 18:10:28 +01:00
Claude Paroz c698c55966 Created special PostgreSQL text indexes when unique is True
Refs #19441.
2013-01-07 17:54:30 +01:00
Anssi Kääriäinen a2396a4c8f Fixed #19173 -- Made EmptyQuerySet a marker class only
The guarantee that no queries will be made when accessing results is
done by new EmptyWhere class which is used for query.where and having.

Thanks to Simon Charette for reviewing and valuable suggestions.
2013-01-06 19:18:28 +02:00
Tim Graham 9b5f64cc6e Fixed #19516 - Fixed remaining broken links.
Added -n to sphinx builds to catch issues going forward.
2013-01-02 18:32:57 -05:00
Aymeric Augustin 7ee7599ab3 Removed versionadded/changed annotations dating back to 1.4. 2012-12-29 21:59:08 +01:00
Aymeric Augustin f27a4ee327 Removed django.contrib.localflavor.
Each localflavor lives on as a separate app.
2012-12-29 21:59:06 +01:00
Tim Graham b3a8c9dab8 Fixed broken links, round 3. refs #19516 2012-12-26 19:07:22 -05:00
Tim Graham 9c5a6adf33 Fixed more broken links. refs #19516 2012-12-25 04:44:09 -05:00
Jason Yan eeaab083fe Fixed #19374 -- Typo in docs/ref/models/instances.txt. 2012-11-27 18:57:50 -08:00
Tim Graham 0e3690d230 Fixed #18974 - Warned against using models.permalink
Thanks dstufft for the draft patch.
2012-11-22 16:08:51 -05:00
Tim Graham 71a3162a70 Documented behavior of get_or_create when multiple objects are returned.
Thanks Matt Lauber for the patch.
2012-11-22 10:36:18 -05:00
Anton Danilchenko 76859e6eab Update docs/ref/models/querysets.txt
Fix typo: replace "can can" to "can"
2012-11-18 18:46:39 +02:00
Danilo Bargen b0c72d0a30 Fixed invalid ipv4 mapped ipv6 addresses in docs 2012-11-07 17:13:06 +01:00
Tim Graham d3fd8a1512 Fixed #15591 - Clarified interaction between ModelForm and model validation. 2012-11-05 18:24:28 -05:00
Alex Gaynor 957787ace0 Added multi-column indexes to the 1.5 release notes. 2012-11-04 15:41:33 -08:00
Eric Davis d94dc2d1fa Fixed formatting of get_FOO_display example 2012-11-04 10:29:10 -08:00
Alex Gaynor 4285571c5a Fixed #5805 -- it is now possible to specify multi-column indexes. Thanks to jgelens for the original patch. 2012-11-04 10:16:06 -08:00
Ulrich Petri ac2052ebc8 Fixed #17549 -- Added a clickable link for URLFields in admin change list. 2012-11-03 11:57:33 +01:00
Preston Holmes 965cc0b1ff Deprecated depth kwarg on select_related.
This is the start of a deprecation path for the depth kwarg on
select_related. Removing this will allow us to update select_related so
it chains properly and have an API similar to prefetch_related.

Thanks to Marc Tamlyn for spearheading and initial patch.

refs #16855
2012-11-02 22:03:33 -07:00
Tim Graham 2f722d9728 Fixed #13869 - Warned that QuerySet.iterator() doesn't affect DB driver caching; thanks jtiai for the suggestion. 2012-10-20 15:22:34 -04:00
Tim Graham db598dd8a0 Fixed #18046 - Documented than an index is created by default for ForeignKeys; thanks jbauer for the suggestion. 2012-10-18 16:58:05 -04:00
Ramiro Morales ec1aad1671 Added section about URL reversion to URL mapper document. 2012-10-07 20:21:07 -03:00
Tim Graham 6d46c740d8 Fixed #17435 - Clarified that QuerySet.update returns the number of rows matched 2012-10-06 07:03:20 -04:00
Preston Holmes ab696e3a21 Merge pull request #425 from Osmose/queryset_doc_typo
Fixed typo in queryset docs under update method.
2012-10-05 09:08:35 -07:00
Michael Kelly 074e65b04a Fixed typo in queryset docs under update method. 2012-10-05 11:32:28 -04:00
Tim Graham 1c03b23567 Fixed #18413 - Noted that a model's files are not deleted when the model is deleted. Thanks lawgon for the report. 2012-10-03 17:43:23 -04:00
Anssi Kääriäinen dad7eec6e1 Corrected links to only()/defer() in Model documentation
Refs #18306
2012-09-30 02:45:50 +03:00
Anssi Kääriäinen 1cd6e04cd4 Fixed #18676 -- Allow fast-path deletion of objects
Objects can be fast-path deleted if there are no signals, and there are
no further cascades. If fast-path is taken, the objects do not need to
be loaded into memory before deletion.

Thanks to Jeremy Dunck, Simon Charette and Alex Gaynor for reviewing
the patch.
2012-09-28 18:16:08 +03:00
Tim Graham 837425b425 Fixed #18934 - Removed versionadded/changed annotations for Django 1.3 2012-09-20 19:06:55 -04:00
Tim Graham 0fdfcee257 Fixed #15325 - Added a link to RelatedManager in the ManytoManyField docs; thanks jammon for the suggestion. 2012-09-19 18:00:14 -04:00
Preston Holmes 8d75b1176f Clearer wording for defer docs 2012-09-15 14:24:01 -07:00
Tim Graham 3bdb65dc59 Updated print statements to work with py3; thanks Claude Paroz noting this. 2012-09-08 15:15:10 -04:00
Tim Graham 6e2bb344e4 Fixed #18478 - Documented how to use a mutable default in a model field. 2012-09-08 14:52:17 -04:00
Tim Graham d823bb790d Fixed #17156 -- Added documentation examples for exists()
Thanks mrmagooey for the draft patch.
2012-09-08 11:19:49 -04:00
Aymeric Augustin e69348b4e7 Avoided mixing dates and datetimes in the examples.
Refs #16023.
2012-09-08 11:00:04 -04:00
Dan Loewenherz 09e3d364b9 specify any orderable field can be specified in get_latest_by, closes #18875 2012-09-07 11:34:18 -04:00
Tim Graham e5983af7c1 Fixed #18904 - Typo in MySQL link; thanks Johie Anderson for the report. 2012-09-05 17:50:17 -04:00
Alex Gaynor 17d57275f9 Fixed #18883 -- added a missing self parameter in the docs 2012-08-30 19:19:11 -07:00
Claude Paroz ebc773ada3 Replaced many smart_bytes by force_bytes
In all those occurrences, we didn't care about preserving the
lazy status of the strings, but we really wanted to obtain a
real bytestring.
2012-08-29 11:20:32 +02:00
Ramiro Morales c73f2bd65c Fixed typo in model fields reference docs. 2012-08-26 00:24:32 -03:00
Tim Graham 13d47c3f33 Fixed #18637 - Updated some documentation for aspects of models that are ModelForm specific, not admin specific.
Thanks Ben Sturmfels for the patch.
2012-08-21 17:38:16 -04:00
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