Commit Graph

548 Commits

Author SHA1 Message Date
Collin Anderson ee23e03637 Fixed #24190 -- Clarified len(queryset) 2015-01-24 10:14:18 -05:00
Tim Graham 33457cd3b0 Removed IPAddressField per deprecation timeline; refs #20439. 2015-01-19 11:12:57 -05:00
Tim Graham 7e8cf74dc7 Removed support for syncing apps without migrations per deprecation timeline.
Kept support for creating models without migrations when running tests
(especially for Django's test suite).
2015-01-18 15:58:06 -05:00
Tim Graham 4aa089a9a9 Removed support for custom SQL per deprecation timeline. 2015-01-17 10:16:06 -05:00
Michał Modzelewski 65246de7b1 Fixed #24031 -- Added CASE expressions to the ORM. 2015-01-12 18:15:34 -05:00
Josh Smeaton 21b858cb67 Fixed #24060 -- Added OrderBy Expressions 2015-01-13 09:39:55 +11:00
Ng Zhi An 8f5d6c77b6 Fixed #23878 -- Moved Query and Prefetch documentation 2015-01-12 11:35:20 -05:00
Anssi Kääriäinen 0c7633178f Fixed #24020 -- Refactored SQL compiler to use expressions
Refactored compiler SELECT, GROUP BY and ORDER BY generation.
While there, also refactored select_related() implementation
(get_cached_row() and get_klass_info() are now gone!).

Made get_db_converters() method work on expressions instead of
internal_type. This allows the backend converters to target
specific expressions if need be.

Added query.context, this can be used to set per-query state.

Also changed the signature of database converters. They now accept
context as an argument.
2015-01-08 14:07:54 -05:00
Daniel Pyrathon fb48eb0581 Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of
Code 2014 project and everyone else who helped with the patch!
2015-01-06 19:25:12 -05:00
Florian Apolloner 1ee9507eb3 Fixed a vesionadded directive. 2014-12-29 10:22:19 +01:00
Josh Smeaton 4718296546 Fixed #23753 -- Added a suite of SQL Functions
Added functions and tests
Added docs and more tests
Added TextField converter to mysql backend
Aliased Value as V in example docs and tests
Removed unicode_compatible in example
Fixed console emulation in examples
2014-12-27 15:27:27 +11:00
Helen Sherwood-Taylor 4ccdf6e57f Fixed #24041 -- Documented effect of changing a model instance's primary key. 2014-12-24 15:06:09 -05:00
Marc Tamlyn 5ca82e710e Fixed #24033 -- Use interval type on Oracle.
Use INTERVAL DAY(9) TO SECOND(6) for Durationfield on Oracle rather than
storing as a NUMBER(19) of microseconds.

There are issues with cx_Oracle which require some extra data
manipulation in the database backend when constructing queries, but it
handles the conversion back to timedelta objects cleanly.

Thanks to Shai for the review.
2014-12-23 10:38:32 +00:00
Marc Tamlyn 57554442fe Fixed #2443 -- Added DurationField.
A field for storing periods of time - modeled in Python by timedelta. It
is stored in the native interval data type on PostgreSQL and as a bigint
of microseconds on other backends.

Also includes significant changes to the internals of time related maths
in expressions, including the removal of DateModifierNode.

Thanks to Tim and Josh in particular for reviews.
2014-12-20 18:28:29 +00:00
Claude Paroz 0a4b04fc23 Used https for most *.python.org links 2014-12-19 18:07:52 +01:00
Josh Smeaton 267a1dcd9b Fixed #23941 -- Removed implicit decimal formatting from expressions. 2014-12-12 10:17:48 -05:00
Tim Graham 1aa41dd000 Fixed #23974 -- Clarified wording of FileField.save/delete save parameter.
Thanks GreenAsJade.
2014-12-08 13:15:46 -05:00
Jon Dufresne 4468c08d70 Fixed #23968 -- Replaced list comprehension with generators and dict comprehension 2014-12-08 07:58:23 -05:00
Tim Graham 5281d9620d Fixed #23965 -- Mentioned that FieldFile inherits from File 2014-12-06 11:51:32 -05:00
Anssi Kääriäinen c7175fcdfe Fixed #901 -- Added Model.refresh_from_db() method
Thanks to github aliases dbrgn, carljm, slurms, dfunckt, and timgraham
for reviews.
2014-11-28 06:54:00 -05:00
Alasdair Nicol 5b26a014a8 Fixed #23865 -- documented how to assign errors to a field in Model.clean()
Also added a unit test wit the simpler syntax which we have documented,
where the dictionary values are strings.
2014-11-21 13:01:28 -05:00
Michal Petrucha 327df551e8 Fixed #23817 -- Updated docs on QuerySet evaluation
Removed inaccurate info about partial evaluation after refs #18702.
Added information on modifying sliced QuerySets; refs #22503.
2014-11-20 09:33:32 -05:00
Josh Smeaton f61256da3a Renamed qn to compiler 2014-11-16 13:19:34 +01:00
Josh Smeaton f59fd15c49 Fixed #14030 -- Allowed annotations to accept all expressions 2014-11-15 14:00:43 +00:00
Tim Graham 11b7680d0e Fixed #23774 -- Clarified QuerySet.order_by() and related models. 2014-11-12 22:00:48 +01:00
Berker Peksag 5c517ec218 Fixed versionchanged indentation in docs/. 2014-11-03 21:40:26 -05:00
Tim Graham e958c760f9 Fixed #23732 -- Corrected and enhanced select_related() docs.
Thanks Daniele Procida for the report and review.
2014-10-31 15:40:07 -04:00
Raul Cumplido 68d3db8a7b Fixed #23725 -- Substituted AUTH_USER_MODEL for User in docs. 2014-10-30 08:29:18 -04:00
Tim Graham 349471eeb9 Fixed spelling errors in docs. 2014-10-28 10:15:52 -04:00
Thomas Chaumeny 00aa562884 Fixed #23493 -- Added bilateral attribute to Transform 2014-10-28 10:02:10 +02:00
Oliver Meinusch 6b39401baf Fixed QuerySet datetimes argument name in docs. 2014-10-27 19:48:29 -04:00
Jon Dufresne c1b9f99a81 Fixed #23676 -- Rearranged sentence; "by default" applies only to max length 2014-10-18 06:55:11 -04:00
Markus Holtermann 04bd84786d Fixed #23602 -- Add comment on get_absolute_url regarding user input 2014-10-06 19:11:06 +02:00
Marc Tamlyn acdbecda05 Fix formatting error in UUIDField docs. 2014-10-04 12:22:11 +01:00
jnothman 20f868bc5a Added flat=False to signature of QuerySet.values_list() 2014-10-01 13:06:30 -04:00
Matt Robenolt ef5f9b6ae8 Fixed #23460 -- Added literal `%s` support to extra() QuerySets. 2014-09-26 13:01:27 -04:00
Marc Tamlyn ed7821231b Fixed #19463 -- Added UUIDField
Uses native support in postgres, and char(32) on other backends.
2014-09-16 10:08:09 +01:00
Tim Graham 60c38c1a4e Fixed #23281 -- Added "concrete model" to glossary.
Thanks knowledgepoint-devs for the suggestion.
2014-09-08 08:45:47 -04:00
Andrew Godwin 6d504562f5 Fixed #22534: Reinforce swappable documentation 2014-09-05 11:39:55 -07:00
Thomas Chaumeny d7a9659110 Fixed documentation links to Query Expression API. 2014-09-04 09:45:10 -04:00
Marc Tamlyn e9103402c0 Fixed #18757, #14462, #21565 -- Reworked database-python type conversions
Complete rework of translating data values from database

Deprecation of SubfieldBase, removal of resolve_columns and
convert_values in favour of a more general converter based approach and
public API Field.from_db_value(). Now works seamlessly with aggregation,
.values() and raw queries.

Thanks to akaariai in particular for extensive advice and inspiration,
also to shaib, manfre and timograham for their reviews.
2014-09-03 20:36:03 +01:00
Simon Charette 05a8cef428 Corrected a usage example of `related_query_name`.
Thanks to Petr Glotov for spotting this.
2014-08-29 23:10:30 -04:00
Tim Graham c587bd5a94 Fixed #17272 -- Documented that non-editable fields are skipped during model validation.
Thanks mitar for the report.
2014-08-19 07:18:05 -04:00
Tim Graham 5dbe2a9431 Fixed #4991 -- Emphasized XSS ramifications of help_text not being escaped. 2014-08-19 06:16:05 -04:00
areski 2a4492aecb Fixed #23224 - Documented EmailValidator. 2014-08-14 13:28:12 -04:00
Tim Graham fb4f3e04b1 Updated MySQL links to version 5.6. 2014-08-02 10:27:01 -04:00
Christoph Heer d47409831f Fixed #23067 -- Updated docs to use django-admin 2014-07-30 14:14:03 -04:00
Tim Graham 66630f589c Fixed #23134 -- Fixed typos in docs/ref/models/querysets.txt.
Thanks Josh Kupershmidt.
2014-07-30 13:03:54 -04:00
Moayad Mardini 668d432d0a Fixed #22491 -- documented how select_for_update() should be tested.
Thanks Andreas Pelme for the report.
2014-07-28 10:57:12 -04:00
David Hoffman 6d5daa30cf Fixed #22553 -- Added refreshing queryset info to docs. 2014-07-26 10:27:02 -04:00
Tim Graham 5f919b9c81 Fixed #23094 -- Removed redundant argument in select_related() example.
Thanks thegeekofalltrades at gmail.com for the report.
2014-07-24 13:57:00 -04:00
Tim Graham 4e4c10bc61 Removed docs for @permalink decorator.
It's been marked as "not recommended" since 1.6. Anyone still using it
may refer to older versions of the docs.
2014-07-10 17:30:39 -04:00
Jorge C. Leitão e1fa7dffdc Fixed #22809 -- Added model Field API reference.
Thanks to @timgraham for the review.
2014-07-10 06:03:04 -04:00
Anubhav Joshi 011abb7d96 Fixed #19671 -- Added warnings that null and validators are ignored for ManyToManyField.
Thanks Loic Bistuer and Tim Graham for help and review.
2014-07-09 16:01:09 -04:00
Tim Graham 5ebf03b7dd Fixed #22351 -- Removed usage of lambdas in model field options.
Thanks claudep for review.
2014-07-09 07:31:50 -04:00
Jorge C. Leitão 8780849da0 Fixed #22812 -- Refactored lookup API documentation.
Thanks Anssi and Tim for reviews.
2014-07-08 20:05:49 -04:00
Tim Graham 7fd55c3481 Fixed #20631 -- Increased the default EmailField max_length to 254.
Thanks pmartin for the report.
2014-07-04 14:15:00 -04:00
Tim Graham 42f5c8f397 Fixed typo in docs/ref/models/instances.txt 2014-07-02 13:21:34 -04:00
Anssi Kääriäinen 0b6f05ede6 Fixed #19501 -- added Model.from_db() method
The Model.from_db() is intended to be used in cases where customization
of model loading is needed. Reasons can be performance, or adding custom
behavior to the model (for example "dirty field tracking" to issue
automatic update_fields when saving models).

A big thank you to Tim Graham for the review!
2014-07-01 16:31:01 +03:00
Renaud Parent 87d0a3384c Fixed #22778 -- Added a model Meta option to define default_related_name.
Thanks jorgecarleitao and mmardini for reviews.
2014-06-18 13:53:07 -04:00
Jorge C. Leitão de90129070 Fixed #14481 -- Documented implicit "through" class created by ManyToManyField.
Thanks to jonathanmorgan for the report and initial patch.
2014-06-18 12:30:10 -04:00
Tim Graham 95cc0e15b4 Fixed #22819 -- Renamed output_type -> output_field in query expression API.
Thanks jorgecarleitao for the suggestion.
2014-06-17 11:57:16 -04:00
Andrew Godwin 24afb1d7a7 Fixed #22660: Doc'd you can't have unmigrated apps depend on migrated 2014-06-15 11:47:23 -07:00
Claude Paroz dfa3505ff1 Fixed #22813 -- Updated Pillow URL in documentation 2014-06-12 08:53:36 +02:00
Anubhav Joshi 42736ac8e8 Fixed #21430 -- Added a RuntimeWarning when unpickling Models and QuerySets from a different Django version.
Thanks FunkyBob for the suggestion, prasoon2211 for the initial patch,
and akaariai, loic, and charettes for helping in shaping the patch.
2014-06-11 10:03:34 -04:00
Guillaume Pannatier 7f27cca5c5 Fixed #22710 -- Amended aggregation note for empty QuerySets
Thanks smeaton for report and Joël Rochat for spell check
2014-06-04 12:44:58 -04:00
Ryan Nowakowski f39b8867a1 Unicode method on model should return unicode
The example of a __unicode__ model method should return a unicode value
instead of a string.
2014-06-02 22:49:43 -05:00
Guillaume Pannatier 7c6e96ec1f Fixed #22710 -- Documented aggregation behavior for empty QuerySets.
Thanks matklad for the report.
2014-05-30 08:01:21 -04:00
Matthew Schinckel 2b432d4634 Fixed typo in docs/ref/models/custom-lookups.txt. 2014-05-25 19:01:51 -04:00
Aliaksandr Semianiuk 5b185ecc68 Fixed #22019 -- Added Model.objects reference documentation. 2014-05-17 08:32:05 -04:00
Daniel Pyrathon cb15231888 Fixed #21798 -- Added check for DateTime mutually exclusive options
Added DateTimeCheckMixin to avoid the use of default, auto_now, and
auto_now_add options together. Added the fields.E151 Error that is raised
if one or more of these options are used together.
2014-05-16 05:57:19 -04:00
Éric Araujo 5ab95168cc Fix typo that disabled code example highlighting 2014-05-14 18:34:59 -04:00
Simon Charette 24ec9538b7 Fixed #19195 -- Allow explicit ordering by a relation `_id` field.
Thanks to chrisedgemon for the report and shaib, akaariai and
timgraham for the review.
2014-04-30 14:23:19 -04:00
Mike Fogel 7fd1b35ed7 Fixed #22537 -- Add tests and improved docs for field subclass with choices. 2014-04-30 07:56:52 -04:00
Moayad Mardini 3776926cfe Fixed #22493 - Added warnings to raw() and extra() docs about SQL injection
Thanks Erik Romijn for the suggestion.
2014-04-25 09:54:49 -04:00
Erik Romijn 75c0d4ea3a Fixed queries that may return unexpected results on MySQL due to typecasting.
This is a security fix; disclosure to follow shortly.
2014-04-21 18:11:26 -04:00
Tim Graham b43bbd6d39 Fixed #22473 -- Emphasized that Model.clean() is not called from Model.save(). 2014-04-18 15:00:26 -04:00
chriscauley 66ec9ee441 Fixed #22378 -- Updated \d to [0-9]+ in urlpatterns of docs and tests.
Thanks tomwys for the suggestion.
2014-04-16 20:36:29 -04:00
Shai Berger 59b1d3098f Documentation fixes for the select_for_update change.
Refs #22343; thanks Tim Graham for the fixes.
2014-04-10 03:40:33 +03:00
Shai Berger f095356ba2 Fixed #22343 -- Disallowed select_for_update in autocommit mode
The ticket was originally about two failing tests, which are
fixed by putting their queries in transactions.

Thanks Tim Graham for the report, Aymeric Augustin for the fix,
and Simon Charette, Tim Graham & Loïc Bistuer for review.
2014-04-10 03:04:51 +03:00
Anubhav Joshi 36de29200e Fixed #22405 -- Fixed string error in models/queries docs. 2014-04-08 13:33:40 +02:00
Tim Graham 51c8045145 Removed versionadded/changed annotations for 1.6. 2014-03-24 11:42:56 -04:00
Adam Kaliński ec08d62a20 Fixed #22048 - Enhanced docs to cover nonexistent one-to-one relationships.
Thanks EvilDMP for the suggestion.
2014-03-24 09:41:04 -04:00
Claude Paroz 3a97f992fb Fixed #22313 -- Removed 'u' prefixes from documentation 2014-03-22 21:32:20 +01:00
Tim Graham 4965a77407 Removed PIL compatability layer per deprecation timeline.
refs #19934.
2014-03-21 10:54:53 -04:00
Bryan Helmig f2eea960e0 Fixed minor syntax error in Queryset docs 2014-03-21 11:02:15 +01:00
Akis Kesoglou aaad3e27ac Fixed #22217 - ManyToManyField.through_fields fixes.
- Docs description of arguments mix up.
- Keep it from erroneously masking E332 check.
- Add checks E338 and E339, tweak message of E337.
2014-03-11 19:33:04 -03:00
Anssi Kääriäinen 219d928852 Fixed #21863 -- supplemented get_lookup() with get_transform()
Also fixed #22124 -- Expanded explanation of exactly what is going on in
as_sql() methods.
2014-03-07 14:52:13 +00:00
Akis Kesoglou c627da0ccc Fixed #14549 - Removed restriction of single FKs on intermediary tables
Thanks to Loic Bistuer for review. Minor changes to error messages
done by committer.
2014-03-05 22:33:58 +02:00
Chris Wilson 95c74b9d69 Fixed #22206 -- Passed models.TextField.max_length to forms.CharField.maxlength 2014-03-05 20:09:28 +01:00
Loic Bistuer 7bbb6958dc Allowed custom querysets when prefetching single valued relations
The original patch for custom prefetches didn't allow usage of custom
queryset for single valued relations (along ForeignKey or OneToOneKey).
Allowing these enables calling performance oriented queryset methods like
select_related or defer/only.

Thanks @akaariai and @timgraham for the reviews. Refs #17001.
2014-03-03 21:35:19 +02:00
Anubhav Joshi bb2ca9fe6c Fixed #22172 -- Allowed index_together to be a single list (rather than list of lists)..
Thanks EmilStenstrom for the suggestion.
2014-03-01 15:44:42 -05:00
Tim Graham 1f5f015c32 Fixed spelling mistakes in docs. 2014-02-28 21:03:46 -05:00
Tim Graham 7f2505ad9e Fixed doc typos. 2014-02-28 11:44:03 -05:00
navneet suman 3390550f6f Fixed #22145 -- Clarified docs on Field.blank and Field.null options.
Thanks skipjack at peru.com for the suggestion.
2014-02-25 20:59:34 -05:00
Szczepan Cieślik e816198034 Fixed docs typos. 2014-02-25 10:28:32 -05:00
Artur Frysiak faf6a911ad Fixed #22023 -- Raised an error for values() followed by defer() or only().
Previously, doing so resulted in invalid data or crash.

Thanks jtiai for the report and Karol Jochelson,
Jakub Nowak, Loic Bistuer, and Baptiste Mispelon for reviews.
2014-02-17 14:46:13 -05:00
chomik 985ae732b2 Fixed #21884 -- Mentioned that exact is the defaut QuerySet lookup type
Thanks to cjerdonek for the suggestion.
2014-02-15 17:17:58 +01:00
Alasdair Nicol 8aa1efff6d Fixed #21951 -- Updated docs to use __str__ for Python 3
Thanks Tim Graham for the report and recommendations
2014-02-13 07:12:40 -05:00
Christopher Adams eefc88feef Fixed #2445 -- Allowed limit_choices_to attribute to be a callable.
ForeignKey or ManyToManyField attribute ``limit_choices_to`` can now
be a callable that returns either a ``Q`` object or a dict.

Thanks michael at actrix.gen.nz for the original suggestion.
2014-02-11 14:05:12 -05:00