Commit Graph

773 Commits

Author SHA1 Message Date
Tim Graham e2d02c1fc9 Used a nontemporal example in QuerySet.bulk_create() in docs. 2016-12-27 09:59:07 -05:00
Tim Graham e2112a5e1a Made cosmetic edits to the "What happens when you save?" docs. 2016-12-17 10:24:08 -05:00
Perry Roper 3be2268992 Added Prefetch import to first use in QuerySet docs. 2016-12-14 13:54:29 -05:00
Yohann Gabory 47ef8f31f3 Fixed #13312 -- Allowed specifying the order of null fields in queries.
Thanks Mariusz Felisiak for finishing the patch.
2016-12-08 09:54:07 -05:00
Simon Charette ad8f6a45eb Replaced RawSQL with Cast in Coalesce doc example. 2016-11-30 12:08:26 -05:00
Tim Graham 55adfc0760 Fixed #27511 -- Corrected Field.related_model docs about GenericRelation. 2016-11-21 12:30:54 -05:00
Jonatas CD b28c6ca763 Fixed #27482 -- Doc'd an example of Case() in QuerySet.filter(). 2016-11-17 12:39:35 -05:00
Jonatas CD 9da45ff352 Fixed #26985 -- Doc'd that ForeignKey.to_field reference must be unique. 2016-11-15 11:09:23 -05:00
Mads Jensen 1446902be4 Fixed #25240 -- Added ExtractWeek and exposed it through the __week lookup.
Thanks to Mariusz Felisiak and Tim Graham for review.
2016-11-11 08:01:40 -05:00
Tim Graham 0d6c7cae7c Inlined a note in docs/ref/models/expressions.txt. 2016-11-09 08:20:59 -05:00
Jop Reyntjes f8fab6f902 Fixed #27414 -- Doc'd that F() expressions on relations return pk values. 2016-11-09 07:11:46 -05:00
Mariusz Felisiak 55993d1e4e Updated Oracle docs links to Oracle 12c. 2016-10-31 14:32:50 -04:00
Michael Scott ec9ed07488 Fixed #27188 -- Allowed using unique=True with FileField.
Thanks Tim Graham for the initial patch.
2016-10-28 20:11:03 -04:00
Tim Graham 414ad25b09 Fixed #27327 -- Simplified time zone handling by requiring pytz. 2016-10-27 08:53:20 -04:00
Marti Raudsepp 51fbe2a60d Updated postgresql.org links to https and made them canonical. 2016-10-25 11:43:32 -04:00
Tim Graham 51b83d9e51 Fixed #27342 -- Corrected QuerySet.update_or_create() example. 2016-10-13 11:02:02 -04:00
Tim Graham c60feb6999 Fixed #25475 -- Doc'd how to use a literal % in Func.template. 2016-10-07 10:24:45 -04:00
Adam Chainz 224fe22bf1 Doc'd that model instances with pk=None don't compare equal. 2016-10-07 09:01:18 -04:00
Tim Graham 9819676676 Updated links to the current version of MySQL docs. 2016-09-30 09:14:17 -04:00
zhuanyenan 17677d510f Corrected docs for return type of Field.formfield(). 2016-09-17 14:26:54 -04:00
Simon Charette 767ba00976 Fixed #27209 -- Fixed typo in docs/ref/models/database-functions.txt.
Thanks Valentin Ignatyev for the report.
2016-09-12 08:07:30 -04:00
Abhishek Bera f3b601f11a Fixed #26987 -- Documented using QuerySet.get() without arguments. 2016-08-19 17:15:33 -04:00
Ian Foote 39f35d4b9d Fixed #25871 -- Added expressions support to QuerySet.values(). 2016-08-18 16:05:15 -04:00
Victor Oliveira da Silva d7804662f8 Made cosmetic edits to Field.default docs. 2016-08-15 10:44:39 -04:00
Tim Graham 9556005425 Fixed #27048 -- Documented that refresh_from_db() doesn't reload @cached_properties. 2016-08-12 18:49:21 -04:00
Akshesh 6e07ec3f65 Fixed #27030 -- Added contrib.postgres.indexes.GinIndex. 2016-08-12 18:37:03 -04:00
Akshesh 311a8e8d50 Fixed #20888 -- Added support for column order in class-based indexes. 2016-08-12 15:52:16 -04:00
Simon Charette b8e6e1b43b
Fixed #26500 -- Added SKIP LOCKED support to select_for_update().
Thanks Tim for the review.
2016-08-08 12:01:43 -04:00
Akshesh 6a8372e6ec Fixed #26808 -- Added Meta.indexes for class-based indexes.
* Added the index name to its deconstruction.
* Added indexes to sqlite3.schema._remake_table() so that indexes
  aren't dropped when _remake_table() is called.

Thanks timgraham & MarkusH for review and advice.
2016-08-05 18:12:51 -04:00
Yoong Kang Lim d30febb4e5 Fixed #26706 -- Made RelatedManager modification methods clear prefetch_related() cache. 2016-08-05 13:32:27 -04:00
Tim Graham 3aaf6cf0f3 Fixed #26925 -- Linked aggregation ordering topic from Meta.ordering docs. 2016-07-25 06:21:39 -04:00
petedmarsh 7bf3ba0d0c Fixed #26899 -- Documented why RawSQL params is a required parameter. 2016-07-21 10:28:31 -04:00
Tim Graham ba246bd5fe Fixed inconsistent indentation in docs/ref/models/options.txt 2016-07-15 13:42:37 -04:00
Simon Charette 8a4f017f45 Fixed #26348 -- Added TruncTime and exposed it through the __time lookup.
Thanks Tim for the review.
2016-07-08 12:35:34 -04:00
Simon Charette 082c52dbed Refs #25774, #26348 -- Allowed Trunc functions to operate with time fields.
Thanks Josh for the amazing testing setup and Tim for the review.
2016-07-08 12:35:34 -04:00
Simon Charette 90468079ec Refs #25774 -- Adjusted datetime database function docs field names. 2016-07-08 12:35:34 -04:00
Romain Garrigues 8be84e2ac4 Fixed #25461 -- Corrected meta API code examples to account for MTI.
In the case of multiple-table inheritance models, get_all_related_objects() and
get_all_related_objects_with_model() don't return the auto-created
OneToOneField, but the new examples didn't account for this.
2016-07-06 09:28:37 -04:00
Tsering fc4b4fd585 Refs #23386 -- Documented that F() expressions are applied on each model.save() 2016-06-28 16:24:56 -04:00
Akshesh 156e2d59cf Fixed #26709 -- Added class-based indexes.
Added the AddIndex and RemoveIndex operations to use them in migrations.

Thanks markush, mjtamlyn, timgraham, and charettes for review and advice.
2016-06-27 10:41:01 -04:00
Tim Graham 20d1cb33c2 Fixed #26787 -- Documented deleting and reloading of model instance fields.
Thanks Julien Hartmann for the report.
2016-06-21 14:39:17 -04:00
Sergey Fedoseev db613f4f12 Refs #14030 -- Updated docs per "Improved expression support for python values."
Complements e2d6e14662.
2016-06-15 10:34:15 -04:00
Jon Dufresne 267dc4addd Fixed #4136 -- Made ModelForm save empty values for nullable CharFields as NULL.
Previously, empty values were saved as strings.
2016-06-13 09:14:36 -04:00
Vytis Banaitis 89ca112884 Fixed a typo in docs/ref/models/querysets.txt 2016-06-04 12:04:40 -04:00
Ed Henderson 4a4d7f980e Fixed #26021 -- Applied hanging indentation to docs. 2016-06-03 11:44:34 -04:00
Will Koster 9899347641 Fixed #26638 -- Allowed callable arguments for QuerySet.get_or_create()/update_or_create() defaults. 2016-06-03 10:00:53 -04:00
Chad Shryock e6c5e68acd Fixed #26526 -- Documented QuerySet.latest()'s dependency on database ordering. 2016-06-02 19:42:08 -04:00
Florian Apolloner 62e4f8ec43 Fixed a typo in the docs. 2016-05-31 16:54:24 +02:00
Ketan Bhatt 59523c06fe Fixed #26679 -- Documented which methods are disabled on RelatedManager if there's an intermediate table. 2016-05-31 07:14:31 -04:00
Nick Smith 838386815f Fixed typo in docs/ref/models/querysets.txt 2016-05-27 09:12:54 -04:00
Tim Graham 46a38307c2 Removed versionadded/changed annotations for 1.9. 2016-05-20 11:44:29 -04:00
Marti Raudsepp b9ae662c97 Fixed #26620 -- Made Model.refresh_from_db() fail when passed unknown kwargs. 2016-05-18 09:27:23 -04:00
Josh Smeaton 2a4af0ea43 Fixed #25774 -- Refactor datetime expressions into public API 2016-05-18 20:14:58 +10:00
Loïc Bistuer ed0ff913c6 Fixed #10506, #13793, #14891, #25201 -- Introduced new APIs to specify models' default and base managers.
This deprecates use_for_related_fields.

Old API:

class CustomManager(models.Model):
    use_for_related_fields = True

class Model(models.Model):
    custom_manager = CustomManager()

New API:

class Model(models.Model):
    custom_manager = CustomManager()

    class Meta:
        base_manager_name = 'custom_manager'

Refs #20932, #25897.

Thanks Carl Meyer for the guidance throughout this work.
Thanks Tim Graham for writing the docs.
2016-05-17 12:07:22 +07:00
Tim Graham e475e84970 Refs #26021 -- Used hanging indentation in some doc examples. 2016-05-14 19:06:31 -04:00
Tim Graham f5ff5010cd Fixed #26483 -- Updated docs.python.org links to use Intersphinx. 2016-05-08 18:07:43 -04:00
Tobias McNulty dbd99de6fa Fixed #26508 -- Clarified docs for various FieldFile methods. 2016-05-07 12:16:42 -04:00
Claude Paroz 388bb5bd9a Fixed #22936 -- Obsoleted Field.get_prep_lookup()/get_db_prep_lookup()
Thanks Tim Graham for completing the initial patch.
2016-05-04 20:02:01 +02:00
Ville Skyttä 575a9a791e Normalized "an SQL" spelling. 2016-05-03 19:30:48 -04:00
Vasiliy Faronov ac77c55bc5 Fixed #26567 -- Updated references to obsolete RFC2616.
Didn't touch comments where it wasn't obvious that the code adhered to
the newer standard.
2016-05-03 11:14:40 -04:00
Anssi Kääriäinen 7f51876f99 Fixed #26207 -- Replaced dynamic classes with non-data descriptors for deferred instance loading. 2016-04-29 13:06:32 -04:00
Tim Graham f945fb24a3 Fixed #26554 -- Updated docs URLs to readthedocs.io 2016-04-28 10:09:57 -04:00
Tim Graham a755e0657e Removed unused BaseExpression.refs_aggregate().
Unused since afe0bb7b13.
2016-04-22 13:04:13 -04:00
Tim Graham 5ac7c8f7ab Refs #22268 -- Fixed typo in docs/ref/models/querysets.txt 2016-04-08 11:43:02 -04:00
Iacopo Spalletti 7d485d5d75 Fixed #22268 -- Documented values_list() behavior for multivalued relations.a
Thanks Sai Krishna for the initial patch.
2016-04-02 07:20:11 -04:00
Simon Charette 64aba7a8ab Fixed #26438 -- Fixed multiple .objects typos in the docs.
Thanks Pablo Oubiña for the report.
2016-03-31 18:27:47 -04:00
Claude Paroz 03b6947728 Fixed #24932 -- Added Cast database function.
Thanks Ian Foote for the initial patch.
2016-03-29 08:14:33 -04:00
Kai Feldhoff 5336158990 Fixed #25759 -- Added keyword arguments to customize Expressions' as_sql(). 2016-03-29 08:09:58 -04:00
Kai Feldhoff 5ca08f7cab Refs #25759 -- Documented customizing expressions' SQL on other databases. 2016-03-21 20:20:29 -04:00
Duane Hilton ca5c05ddbe Fixed #26239 -- Added a note about how auto_now works with QuerySet.update(). 2016-03-12 12:39:00 -05:00
Tim Graham de8a11ba18 Fixed #26321 -- Added missing "for_save" parameter in expressions example.
Thanks tomaszn for the patch.
2016-03-03 19:36:03 -05:00
Tim Graham c0181f2c1f Fixed #26310 -- Documented that a queryset ordering must be specified to ensure ordered results.
Thanks Simon Charette for review.
2016-03-03 17:54:07 -05:00
Tim Graham 1d17bb4f7d Refs #19527 -- Fixed typo in docs/ref/models/querysets.txt. 2016-03-02 15:54:46 -05:00
Marc Tamlyn 8ddc79a799 Fixed #26285 -- Deprecated the MySQL-specific __search lookup. 2016-03-02 14:41:56 -05:00
acrefoot 04240b2365 Refs #19527 -- Allowed QuerySet.bulk_create() to set the primary key of its objects.
PostgreSQL support only.

Thanks Vladislav Manchev and alesasnouski for working on the patch.
2016-03-02 14:29:09 -05:00
Taranjeet 11a8207d42 Fixed typos in docs/ref/models/meta.txt. 2016-03-01 08:33:27 -05:00
Simon Charette 0223e213dd Fixed #26186 -- Documented how app relative relationships of abstract models behave.
This partially reverts commit bc7d201bdb.

Thanks Tim for the review.

Refs #25858.
2016-02-29 22:07:05 -05:00
chenesan b84f5ab4ec Fixed #26230 -- Made default_related_name affect related_query_name. 2016-02-27 08:48:32 -05:00
Adam Chainz ef33bc2d4d Fixed #25279 -- Made prefetch_related_objects() public. 2016-02-26 14:55:01 -05:00
Claude Paroz d43156e1e9 Fixed #26238 -- Raised explicit error for non-editable field in ModelForm
Thanks Luke Crouch for the report and Simon Charette for the review.
2016-02-21 00:24:20 +01:00
Tim Graham 88034c9938 Fixed #25687 -- Documented how to add database function support to third-party backends.
Thanks Kristof Claes for the initial patch.
2016-02-17 13:36:12 -05:00
Brobin dca8b916ff Fixed #26154 -- Deprecated CommaSeparatedIntegerField 2016-02-10 17:57:43 -05:00
Tim Graham 8ce8beb3f2 Unified some doc links to OneToOneField and ManyToManyField. 2016-02-01 11:02:26 -05:00
rowanv a6ef025dfb Fixed #26124 -- Added missing code formatting to docs headers. 2016-02-01 10:42:05 -05:00
James Pulec f05722a08a Fixed #25354 -- Added class/app_label interpolation for related_query_name. 2016-01-28 11:10:47 -05:00
Elif T. Kus bca9faae95 Fixed #26020 -- Normalized header stylings in docs. 2016-01-22 12:12:17 -05:00
Tim Graham 28acc0d6df Fixed #26078 -- Clarified "old vs. new" in model._meta upgrade guide.
Thanks Thomas Güttler for the suggestion.
2016-01-14 07:24:25 -05:00
pp b34ff66e5b Added missing period to "etc.". 2016-01-11 18:05:15 -05:00
Marten Kenbeek 16411b8400 Fixed #26013 -- Moved django.core.urlresolvers to django.urls.
Thanks to Tim Graham for the review.
2015-12-31 14:21:29 -05:00
Bryan Marty 62ca2dea04 Fixed #8065 -- Made id_list an optional argument for QuerySet.in_bulk(). 2015-12-26 17:57:19 -05:00
Alexander Sosnovskiy 2a7ce34600 Fixed #14286 -- Added models.BigAutoField. 2015-12-25 20:01:31 -05:00
Chris Lamb 77b8d8cb6d Discouraged use of /tmp with predictable names.
The use of predictable filenames in /tmp often leads to symlink attacks
so remove the most obvious use of them in the docs.
2015-12-24 09:54:33 -05:00
Alexander Sosnovskiy b61eab18f7 Fixed #13774 -- Added models.Field.rel_db_type(). 2015-12-04 07:55:41 -05:00
Qile Wang 83a710b8d3 Fixed typo in docs/ref/models/instances.txt 2015-12-03 12:55:32 -05:00
Jon Dufresne 7aabd62380 Fixed #25778 -- Updated docs links to use https when available. 2015-12-01 08:01:34 -05:00
Sergey Fedoseev da08195b36 Removed old versionadded/changed directives. 2015-11-30 18:45:57 -05:00
Bulgantamir Gankhuyag 8bce6fa637 Clarified default value for DateField to emulate auto_now_add. 2015-11-24 08:38:14 -05:00
areski 1e7da99ea6 Corrected GenericIPAddressField protocol parameter doc. 2015-11-19 11:18:31 -05:00
Tim Graham a8f05f405f Replaced "inbuilt" with more common "built-in". 2015-11-12 17:29:03 -05:00
Alex Morozov 4373eac998 Fixed #25132 -- Documented how to retrieve a single value using values_list() and get(). 2015-11-03 12:23:45 +00:00
Sergey Fedoseev 0a26121797 Refs #25629 -- Added `arity` class attribute to `Func` expressions 2015-11-02 20:09:21 +01:00
Tim Graham 69239c0f96 Fixed #21422 -- Documented that prefetch_related() results must be homogeneous. 2015-10-30 10:26:54 -04:00
Tim Graham 9c5e272860 Fixed #25550 -- Deprecated direct assignment to the reverse side of a related set. 2015-10-27 07:57:15 -04:00
Tim Graham f6b9e6bf4f Fixed typo in docs/ref/models/relations.txt. 2015-10-13 04:24:22 -07:00
Tim Graham e0837f2cb1 Fixed #25508 -- Modified QuerySet.__repr__() to disambiguate it from a list. 2015-10-06 12:38:34 -04:00
Tim Graham de99f558d8 Fixed #25462 -- Removed Model.__unicode__() in favor of @python_2_unicode_compatible. 2015-09-25 13:28:12 -04:00
Tim Graham 54848a96dd Removed versionadded/changed annotations for 1.8. 2015-09-23 19:31:11 -04:00
Tim Graham c64dd646f5 Refs #12663 -- Removed deprecated Model._meta methods. 2015-09-23 19:31:09 -04:00
Alex Hill 134ca4d438 Fixed #24509 -- Added Expression support to SQLInsertCompiler 2015-09-22 23:35:24 +10:00
Josh Smeaton 534aaf56f4 Fixed #24629 -- Unified Transform and Expression APIs 2015-09-21 19:56:24 +10:00
Mariusz Felisiak 6f1b09bb5c Made assorted improvements to the Oracle documentation. 2015-09-18 09:47:32 -04:00
Renato Oliveira e3720b990a Fixed #25382 -- Removed obsolete references to DateQuerySet. 2015-09-11 12:16:06 -04:00
Tim Graham 7c0850028f Documented a limitation of Options.required_db_features. 2015-09-03 13:37:39 -04:00
Adam Brenecki 52a190b657 Fixed #24988 -- Documented passing a dictionary of ValidationErrors to ValidationError 2015-08-13 14:17:02 -04:00
Tim Graham 5980b05c1f Fixed #25160 -- Moved unsaved model instance data loss check to Model.save()
This mostly reverts 5643a3b51b and
81e1a35c36.

Thanks Carl Meyer for review.
2015-08-10 08:51:32 -04:00
Caio Ariede ec9004728e Fixed #25175 -- Renamed the postgresql_psycopg2 database backend to postgresql. 2015-08-07 09:33:17 -04:00
Tim Graham e8cd65f829 Fixed #25213 -- Discouraged use of QuerySet.extra()
Thanks Anssi Kääriäinen for the draft text and Simon Charette
for review.
2015-08-05 08:01:11 -04:00
Tim Graham 97fa7fe961 Fixed #25212 -- Documented the RawSQL expression. 2015-08-05 07:54:54 -04:00
Alasdair Nicol b792c4804b Removed unnecessary F() from Func expressions docs 2015-07-31 01:40:35 +01:00
Simon Charette 6a46f23957 Refs #18556 -- Fixed a typo in the related manager add() method docs. 2015-07-27 22:50:13 -04:00
Tim Graham adc0c4fbac Fixed #18556 -- Allowed RelatedManager.add() to execute 1 query where possible.
Thanks Loic Bistuer for review.
2015-07-28 09:28:25 +07:00
Flavio Curella c2e70f0265 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 2015-07-27 18:28:13 -04:00
Tim Graham 87d55081ea Fixed #25159 -- Removed brackets from class/function/method signatures in docs.
Thanks hellbeast for the initial patch.
2015-07-27 10:32:47 -04:00
Tim Graham b60375d4bb Fixed #25129 -- Made model instance defaults work with migrations (refs #24919). 2015-07-21 09:19:40 -04:00
Edward Henderson f8cc464452 Fixed #16501 -- Added an allow_unicode parameter to SlugField.
Thanks Flavio Curella and Berker Peksag for the initial patch.
2015-07-17 13:48:58 -04:00
Luke fd869cceac Fixed mistake in Model.from_db() example. 2015-07-03 09:08:22 -04:00
William Schwartz 9a5cfa05a0 Fixed #24997 -- Enabled bulk_create() on proxy models 2015-07-02 13:53:51 -04:00
Tim Graham aaacaeb096 Renamed RemovedInDjangoXYWarnings for new roadmap.
Forwardport of ae1d663b79
from stable/1.8.x plus more.
2015-06-24 16:08:20 -04:00
johannes.linke 27c839e0fc Fixed #24881 -- Clarified Meta.order_with_respect_to documentation 2015-06-19 07:01:54 -04:00
Adam Chainz d34d39ade7 Fixed #24894 -- Added contrib.postgres.functions.TransactionNow 2015-06-15 14:03:17 -04:00
Matt Deacalion Stevens 77f3d7adb1 Clarified the default form widgets for model number fields in docs 2015-06-09 12:33:01 -04:00
Alasdair Nicol 1f5b067710 Fixed #24952 -- Fixed example SQL in Func() expressions docs 2015-06-08 15:14:15 +01:00
Tim Graham 6b41834855 Minor edits to Greatest/Least docs; refs #24767. 2015-06-05 11:40:10 -04:00
Yamila Moreno cbe4efcbc1 Fixed #22571 -- Added clarification about auto_now_add=True 2015-06-05 09:56:02 -04:00
Tim Graham 2fbea621e6 Capitalized "Python" in docs. 2015-06-05 08:24:53 -04:00
Ian Foote 14dead04ac Fixed #24925 -- Document using Coalesce on MySQL
Add warning for using Coalesce with python values on MySQL and document
workaround.
2015-06-05 11:18:58 +01:00
Ian Foote 4ab53a558a Fixed #24767 -- Added Greatest and Least expressions
Greatest and Least are row-level Function versions of Min and Max.
2015-06-05 11:15:33 +01:00
Matthew Somerville 2dc93bb10a Fixed #22316 -- Added time filters to TimeField on SQLite.
This was implemented for non-SQLite backends in 1.7 (as a
side effect of #16187).
2015-06-04 22:27:13 -04:00
Adam Chainz 23048d186c Fixed #24866 -- Added Now() database function 2015-06-02 17:59:01 -04:00
Jon Dufresne 44f3ee7716 Fixed #9596 -- Added date transform for DateTimeField. 2015-06-02 08:49:10 -04:00
Przemysław Suliga d29ed3f355 Fixed #24880 -- Added more explicit docs on select_for_update() on SQLite. 2015-06-01 08:53:12 -04:00
Alexander Sosnovskiy 04e8d890ae Fixed #16891 -- Made Model/QuerySet.delete() return the number of deleted objects. 2015-05-22 13:27:16 -04:00
David Krisch 1a62f19707 Fixed #24763 -- Moved DoesNotExist exception to model docs. 2015-05-08 13:05:50 -04:00
Ian Foote 756a727252 Fixed typo in docs/ref/models/expressions.txt 2015-05-07 20:15:24 -04:00
Luis Del Giudice 69ddc1b3da Fixed #24693 -- Added label and label_lower property to Model._meta 2015-05-02 16:58:18 +02:00
Tim Graham 2b086229a2 Fixed #24665 -- Clarified model field flag defaults. 2015-04-29 20:35:22 -04:00
Tim Graham 2d76b61dc2 Fixed #24649 -- Allowed using Avg aggregate on non-numeric field types. 2015-04-25 13:06:14 -04:00
Nicolas Noé 37682368a6 Fixed #24656 -- Added missing imports to query expressions doc. 2015-04-24 10:54:19 -04:00
Richard Eames dd99f57710 Fixed #24613 -- Added example to QuerySet.defer() documentation 2015-04-22 19:18:57 -04:00
Jon Dufresne b5e0eede40 Fixed #22394 -- Refactored built-in datetime lookups to transforms. 2015-04-20 15:11:11 -04:00
Neal Todd d84f01ff08 Amended get_all_related_objects() backwards compatible replacement. 2015-04-20 09:50:17 -04:00