Commit Graph

530 Commits

Author SHA1 Message Date
Alex Gaynor bb5ab908cc Fixed a typo in the documentation 2013-11-26 13:49:54 -06:00
Ludwik Trammer 70e61310d6 Fixed #21507 -- Corrected default widget information for FileField 2013-11-25 08:26:10 -05:00
Thomas Orozco 957d22b850 Add missing commas in Prefetch docs 2013-11-23 23:48:34 +01:00
Loic Bistuer 82a58ce5b6 Fixed #21491 -- Removed documented workaround for a known issue.
The issue was that two M2M hidden reverse managers
(related_name ending with a '+') could clash with each other.

Refs #21375 and #15932. Thanks Baptiste.
2013-11-23 01:29:09 +07:00
Loic Bistuer 27f04e79b1 Fixed #21479 -- Favor 'migrate' over 'syncdb' in the docs. 2013-11-21 15:12:39 +01:00
Markus Amalthea Magnuson b6a6cf4ab7 Fixed #21427 -- Clearly state integer field value ranges in docs
Added an explicit mention of the exact value ranges for integer type
fields that are safe in all databases supported by Django. Also, put
all value numbers inside double ticks.
2013-11-21 14:15:23 +01:00
Loic Bistuer f51c1f5900 Fixed #17001 -- Custom querysets for prefetch_related.
This patch introduces the Prefetch object which allows customizing prefetch
operations.

This enables things like filtering prefetched relations, calling select_related
from a prefetched relation, or prefetching the same relation multiple times
with different querysets.

When a Prefetch instance specifies a to_attr argument, the result is stored
in a list rather than a QuerySet. This has the fortunate consequence of being
significantly faster. The preformance improvement is due to the fact that we
save the costly creation of a QuerySet instance.

Thanks @akaariai for the original patch and @bmispelon and @timgraham
for the reviews.
2013-11-07 14:49:49 +02:00
Baptiste Mispelon 366bdc4566 Fixed typos in documentation. 2013-11-06 10:47:07 +01:00
Tim Graham ffcfb4cdcc Fixed #21344 -- Typo in docs/ref/models/queries.txt 2013-10-28 14:52:26 -04:00
Shai Berger 317040a73b Fixed #13245: Explained Oracle's behavior w.r.t db_table
and how to prevent table-name truncation

Thanks russellm & timo for discussion, and timo for review.
2013-10-23 14:51:22 +03:00
Florian Hahn 5240b83462 Fixed #17027 -- Added support for the power operator in F expressions.
Thanks dan at dlo.me for the initial patch.

- Added __pow__ and __rpow__ to ExpressionNode
- Added oracle and mysql specific power expressions
- Added used-defined power function for sqlite
2013-10-22 10:29:57 -04:00
Juergen Schackmann f8632572ad Fixed #21212 -- Documented the reverse name for OneToOneField.
Thanks bjb at credil.org for the report.
2013-10-18 16:19:05 -04:00
Marc Tamlyn 349c12d3f5 Fixed #16855 -- select_related() chains as expected.
select_related('foo').select_related('bar') is now equivalent to
select_related('foo', 'bar').

Also reworded docs to recommend select_related(*fields) over select_related()
2013-10-15 15:59:36 +01:00
Tim Graham 945e033a69 Fixed #8918 -- Made FileField.upload_to optional.
Thanks leahculver for the suggestion and dc and vajrasky for work
on the patch.
2013-10-11 08:07:25 -04:00
Tim Graham 1dae4ac177 Whitespace cleanup.
* Removed trailing whitespace.
* Added newline to EOF if missing.
* Removed blank lines at EOF.
* Removed some stray tabs.
2013-10-10 16:49:20 -04:00
Tim Graham 75bb6ba966 Fixed #10913 -- Documented how related_name affects QuerySet filtering
Thanks neithere for the suggestion.
2013-10-02 12:12:53 -04:00
Erik Romijn 1a63092981 Fixed #20439 -- Started deprecation of IPAddressField 2013-09-28 10:55:32 +02:00
mlissner d8f2d940cc Correct very minor typo
Just changed as to has.
2013-09-21 13:34:45 -07:00
Matt Austin 9451d8d558 Fixed #21095 -- Documented new requirement for dates lookups.
Day, month, and week_day lookups now require time zone definitions in the database.
2013-09-13 09:56:19 +02:00
Tim Graham fb51c9a0f2 Fixed spelling; refs #16895.
Thanks Panagiotis Issaris for the report.
2013-09-09 11:30:31 -04:00
e0ne cbf08c6b0c Fixed #16895 -- Warned about cost of QuerySet ordering
Thanks outofculture at gmail.com for the suggestion.
2013-09-09 09:47:18 -04:00
Aymeric Augustin e192739b3e Fixed #20409 -- Clarified how unique_for_date works when USE_TZ is set. 2013-09-07 14:08:54 -05:00
Tim Graham 38d2e7c225 Merge pull request #1567 from technivore/ticket_20970
re-indented method documentation within RelatedManager
2013-09-06 12:07:25 -07:00
Matthew Rich af67b93c02 re-indented method documentation within RelatedManager 2013-09-06 13:44:40 -05:00
Daniele Procida 263eecc583 Merge pull request #1544 from evildmp/ticket_20920_rebase
Fixed #20920 -- Consolidated F() and Q() documentation
2013-09-06 11:27:58 -07:00
evildmp 79cc66692a Consolidated documentation for F() and Q() 2013-09-06 12:57:25 -05:00
Matthew Rich a5bcc09c8f documented RelatedManager calling save() behind the scenes, added section on direct replacement of related object set 2013-09-06 11:37:08 -05:00
Eric Boersma 4d13cc56de Fixed #21035 -- Changed docs to treat the acronym SQL phonetically.
The documentation and comments now all use 'an' to
refer to the word SQL and not 'a'.
2013-09-05 20:14:58 -04:00
Tim Graham a89c856a7a Fixed typo in docs/ref/models/options.txt 2013-08-30 21:05:36 -04:00
Anssi Kääriäinen e973ee6a98 Fixed #20988 -- Added model meta option select_on_save
The option can be used to force pre 1.6 style SELECT on save behaviour.
This is needed in case the database returns zero updated rows even if
there is a matching row in the DB. One such case is PostgreSQL update
trigger that returns NULL.

Reviewed by Tim Graham.

Refs #16649
2013-08-30 09:41:07 +03:00
Andrew Godwin 5569b0b92f Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/backends/oracle/base.py
	django/db/backends/postgresql_psycopg2/base.py
	django/db/models/signals.py
	tests/queries/tests.py
2013-08-23 12:36:53 +01:00
Anssi Kääriäinen 6af05e7a0f Fixed model.__eq__ and __hash__ for no pk value cases
The __eq__ method now considers two instances without primary key value
equal only when they have same id(). The __hash__ method raises
TypeError for no primary key case.

Fixed #18864, fixed #18250

Thanks to Tim Graham for docs review.
2013-08-22 17:24:07 +03:00
Kevin Christopher Henry 7775ced938 Documentation - Noted that OneToOneField doesn't respect unique.
Added OneToOneField to the list of model fields for which the unique
argument isn't valid. (OneToOneFields are inherently unique, and if
the user supplies a value for unique it is ignored / overwritten.)
2013-08-21 22:32:04 +01:00
Kevin Christopher Henry bb011cf809 Documentation -- Corrected error about Model.full_clean()
Although the ModelForm validation code was changed to call
Model.full_clean(), the documentation still said otherwise. The
offending phrase was removed.
2013-08-21 15:38:07 -04:00
Kevin Christopher Henry 83e434a2c2 Documentation - Noted that OneToOneField doesn't respect unique.
Added OneToOneField to the list of model fields for which the unique
argument isn't valid. (OneToOneFields are inherently unique, and if
the user supplies a value for unique it is ignored / overwritten.)
2013-08-20 21:20:29 -07:00
Andrew Godwin b6a957f0ba Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	docs/ref/django-admin.txt
2013-08-19 18:30:48 +01:00
Tim Graham 7b69c3e775 Removed versionadded/changed annotations for 1.5 2013-08-19 09:09:41 -04:00
Anssi Kääriäinen 3844089edc Fixed #20777 -- Admin proxy model deletion regression
Added proxy_models tests by Harm Geerts <github@geertswei.nl>.
2013-08-19 09:51:41 +03:00
Anssi Kääriäinen 4668c142dc Made Model.__eq__ consider proxy models equivalent
Fixed #11892, fixed #16458, fixed #14492.
2013-08-19 09:51:28 +03:00
Tim Graham 29255fcb4f Fixed some ReST errors regarding backticks 2013-08-15 07:14:10 -04:00
Andrew Godwin 588b523233 Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/models/options.py
2013-08-09 14:37:37 +01:00
Tim Graham ddae74b64c Fixed #9057 -- Added default_permissions model meta option.
Thanks hvendelbo for the suggestion and koenb for the draft patch.
2013-08-09 09:19:52 -04:00
Andrew Godwin de64c4d6e9 Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/core/management/commands/flush.py
	django/core/management/commands/syncdb.py
	django/db/models/loading.py
	docs/internals/deprecation.txt
	docs/ref/django-admin.txt
	docs/releases/1.7.txt
2013-08-09 14:17:30 +01:00
Preston Holmes cf041b883c Merge pull request #1453 from chrismedrela/ticket20484-improvement
Fixed #20484 again -- added note to field documentation
2013-08-07 14:10:24 -07:00
Christopher Medrela fb26c4996a Fixed #20484 again -- added note to field documentation 2013-08-07 20:57:56 +02:00
Dominic Rodger c33d1ca1d9 Fixed #20852 - Fixed incorrectly generated left quotes in docs.
Sphinx generates left single quotes for apostrophes after
code markup, when right single quotes are required. The
easiest way to fix this is just by inserting the unicode
character for a right single quote.

Instances of the problem were found by looking for
">&#8216;" in the generated HTML.
2013-08-06 07:13:17 -04:00
Jimmy Song 94d7fed775 Fixed #20859 - Clarified Model.clean() example. 2013-08-05 09:06:09 -04:00
Daniele Procida e8183a8193 Fixed #20842 and #20845 - Added a note on order_by() and improved prefetch_related() docs. 2013-08-04 12:34:28 -04:00
Curtis Maloney 07876cf02b Deprecated SortedDict (replaced with collections.OrderedDict)
Thanks Loic Bistuer for the review.
2013-08-04 07:09:39 -04:00
Tim Graham 5df84b268d Removed unused model option "admin" 2013-08-01 10:27:30 -04:00
Alex Couper 1123f45511 Fixed #20649 -- Allowed blank field display to be defined in the initial list of choices. 2013-07-31 14:12:03 -04:00
Loic Bistuer acd1d439fd Fixed #20826 -- Moved Manager.raw() and Manager._insert() to the QuerySet class. 2013-07-31 09:54:00 -04:00
Julien Phalip 47c755327b Fixed a number of minor misspellings. 2013-07-27 18:46:03 -07:00
Loic Bistuer 31fadc1202 Fixed #20625 -- Chainable Manager/QuerySet methods.
Additionally this patch solves the orthogonal problem that specialized
`QuerySet` like `ValuesQuerySet` didn't inherit from the current `QuerySet`
type. This wasn't an issue until now because we didn't officially support
custom `QuerySet` but it became necessary with the introduction of this new
feature.

Thanks aaugustin, akaariai, carljm, charettes, mjtamlyn, shaib and timgraham
for the reviews.
2013-07-26 12:41:27 +03:00
Andrew Godwin f8297f6323 More migration docs, and conversion of all easy syncdb references 2013-07-25 16:19:36 +01:00
Tim Graham 2333c9662b Fixed #14007 -- Added model discovery in models module without the need to specify app_label.
Thanks mark@ and Aramgutang for work on the patch.
2013-07-16 19:32:30 -04:00
Karol Sikora 6272d2f155 Fixed #20429 -- Added QuerySet.update_or_create
Thanks tunixman for the suggestion and Loic Bistuer for the review.
2013-07-12 08:26:35 -04:00
Tim Graham 3cdeb572d7 Fixed #17528 -- Documented that add() and remove() with a many-to-many relationship do not call Model.save() 2013-07-12 06:19:16 -04:00
Christopher Medrela ac223ff6d1 Fixed #20735 -- clarified ManyToManyField constructor doc 2013-07-12 11:50:08 +02:00
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
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
Jannis Leidel 2eadc418af Fixed doc references to `django.db.models.query.QuerySet` and converted some tabs that were introduced in r16699 to spaces.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16915 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-30 10:28:39 +00:00
Jannis Leidel 2a2381a682 Added versionadded directive for the `bulk_create` Queryset method introduced in r16739.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16885 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-22 15:04:34 +00:00
Ramiro Morales 26b8122087 Fixed #14675 -- Completed removal of `from django.conf.urls.default import *` usage.
This applies to both our own [test] code and documentation examples. Also:
 * Moved the functions and handlers from `django.conf.urls.defaults` up to
   `django.conf.urls` deprecating the former module.
 * Added documentation for `handler403`.
 * Tweaked the URLs topic document a bit.

Thanks to pupeno and cdestigter for their great work contributing patches.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16818 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-11 22:36:16 +00:00