Commit Graph

1460 Commits

Author SHA1 Message Date
Andrew Godwin 4d2f9c38e8 Fixed #23288: deconstruct() ignoring related_name 2014-08-14 19:47:22 -07:00
Anssi Kääriäinen f7dba61881 Avoided creation of deferred model from another deferred model
Also never create deferred model when no attrs are deferred.
2014-08-12 14:58:10 +03:00
Josh Smeaton 5b0375ec3e Fixed #23001 -- Fixed mixing defer and annotations 2014-08-12 14:58:10 +03:00
Anssi Kääriäinen dfadbdac6a Fixed #16426 -- deletion of 1000+ objects with relations on SQLite
SQLite doesn't work with more than 1000 parameters in a single query.
The deletion code could generate queries that try to get related
objects for more than 1000 objects thus breaking the limit. Django now
splits the related object fetching into batches with at most 1000
parameters.

The tests and patch include some work done by Trac alias NiGhTTraX in
ticket #21205.
2014-08-11 12:47:37 +03:00
Anubhav Joshi cdfdcf4b70 Fixed #23266 -- Prevented queries caused by type checking lookup values
Small modifications done by committer.
2014-08-11 09:51:57 +03:00
Rajiv Makhijani f0b358880a Fixed #23259 -- Corrected insertion order of extra() select_params
A regression caused queries to produce incorrect results for cases where
extra(select) is excluded by values() but included by extra(order_by)

The regression was caused by 2f35c6f10f.
2014-08-11 09:33:18 +03:00
Tim Graham f9f9f3ad60 Fixed flake8 warning. 2014-08-07 10:11:15 -04:00
Alex Hill 938da36cb1 Fixed #21603 -- Fixed complex RawQuerySets queries on some versions of SQLite. 2014-08-06 08:41:34 -04:00
Tim Graham fcd42a4819 Removed code that assumed BooleanField could be null.
Such a field will no longer pass model validation.
2014-08-05 07:49:53 -04:00
Shai Berger 746f2a4bed Fixed #23061: Avoided setting a limit on a query for get with select_for_update on Oracle
Thanks Michael Miller for reporting the issue.
2014-08-05 03:12:08 +03:00
Stanislas Guerra 98e8da3709 Fixed #16311 -- Added a RelatedOnlyFieldListFilter class in admin.filters. 2014-08-04 09:39:02 -04:00
Baptiste Mispelon 44169a00c1 Removed unnecessary code in ManyToManyField.deconstruct() 2014-08-03 15:15:24 +02:00
Baptiste Mispelon 7432533932 Added missing logic to TimeField.deconstruct().
If auto_now or auto_now_add was used then the serialized
field in the migration contained unnecessary `editable` and
`blank` arguments.
2014-08-03 14:02:21 +02:00
Baptiste Mispelon 72f1eb48df Fixed #23156 -- Added missing BinaryField.deconstruct() method. 2014-08-03 13:02:31 +02:00
Mitar 1ed6fbcf44 Fixed #21940 -- Added kwargs to contribute_to_class() of model fields..
Thanks Kronuz for the suggestion.
2014-08-01 07:41:28 -04:00
areski 97a38de230 Fixed #23112 -- Field.get_choices tries to index an iterable 2014-07-30 21:35:02 +02:00
Florian Apolloner 2f73b527dd Fixed #23098 -- Checked that lazy choices are not evaluated too soon
Thanks Matthieu Agopian for the report.
2014-07-27 13:31:25 +02:00
Abraham Martin e1347e9253 Fixed #23101 db_table wasn't copied in deconstruct
Forward port of 999758fc7a from
stable/1.7.x
2014-07-26 10:00:02 -07:00
Federico Frenguelli 6eed751162 Fixed #22887 -- Added comment for translators on unique_for_date error message 2014-07-26 13:55:20 +02:00
Gavin Wahl 6e2b82fdf6 Fixed #22998 -- Updated the fast_delete logic for GFKs 2014-07-16 12:28:00 +03:00
Shai Berger dd9b3312d0 Fixed name of database connection feature 2014-07-14 19:23:57 +03:00
Anssi Kääriäinen 9cd5201abd Fixed #22994 -- regression with generic FK + admin list_view
The reason for the regression was that the GenericForeignKey field isn't
something meta.get_field_by_name() should return. The reason is that a
couple of places in Django expects get_field_by_name() to work this way.
It could make sense to return GFKs from get_field_by_name(), but that
should likely be done as part of meta refactoring or virtual fields
refactoring patches.

Thanks to glicerinu@gmail.com for the report and to Tim for working on
the issue.
2014-07-14 10:50:41 -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
Daniel Hahler 67f9f385aa Fixed various minor doc typos / references. 2014-07-05 20:26:26 -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
Anubhav Joshi 10e83d48a3 Fixed #22935 -- Changed ForeignKey.default_error_messages['invalid'] to refer to correct field.
Thanks Tim Graham for suggestion and review.
2014-07-02 13:01:36 -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
Anubhav Joshi 34ba86706f Fixed #14334 -- Query relation lookups now check object types.
Thanks rpbarlow for the suggestion; and loic, akaariai, and jorgecarleitao
for reviews.
2014-07-01 06:12:58 -04:00
Anubhav Joshi fd5897193f Fixed problem with refs #10811.
When 'to_field' is specified with a FK, then we need to check the pk value
the object.
2014-06-30 10:25:57 -04:00
Lovas Bence 9385aa3198 Fixed #22050 -- Fixed defer fields on proxy related models. 2014-06-25 07:20:18 -04:00
Andrew Godwin 0b571753a8 Fixed #22889: Unneeded to_field in fk.deconstruct causing swap issues 2014-06-23 20:39:17 -07:00
Anubhav Joshi 1c50d6ae2b Fixed problem introduced with #refs 13711. 2014-06-23 19:36:40 +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
Anubhav Joshi 91f1b6dcdc Fixed #13711 -- Model check added to ensure that auto-generated column name is within limits of the database.
Thanks russellm for report and Tim Graham for review.
2014-06-17 16:16:02 -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
Jorge C. Leitão d2cbcbcc76 Improved code style of Query.table_alias() usage. 2014-06-14 15:14:13 +02:00
Jorge C. Leitão 0b980ef857 Removed unnecessary attribute assigment to SQLCompiler. 2014-06-14 15:14:12 +02:00
Jorge C. Leitão e66896226a Fixed #22826 -- Improved internal usage of Query.setup_joins. 2014-06-14 15:14:12 +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
Anubhav Joshi 5643a3b51b Fixed #10811 -- Made assigning unsaved objects to FK, O2O, and GFK raise ValueError.
This prevents silent data loss.

Thanks Aymeric Augustin for the initial patch and Loic Bistuer for the review.
2014-06-05 13:12:01 -04:00
Craig de Stigter ce993efda8 Fixed #22690 -- Added a check for proxy models containing fields.
Removed the FieldError raised by ModelBase.__new__ in this case.
2014-06-02 09:32:38 -04:00
Vincent-Vega d04e730224 Fixed #22711 -- Adjusted ordering checks to allow implicit relation fields.
refs #19195.
2014-06-01 15:36:25 -04:00
Alex Gaynor 1dcc603eff Fixed several typos in Django 2014-05-28 17:39:14 -07:00
Víðir Valberg Guðmundsson 6cfa2fae39 Fixed #22720 -- Migrations attempt to create _order twice. 2014-05-29 01:00:30 +02:00
Ramiro Morales d731f48ece Merge pull request #2679 from ramiro/t22421
Fixed #22421 -- Regression in fixtures loading.
2014-05-21 18:57:46 -03:00
Loic Bistuer 870b0a1f86 Fixed the ordering of prefetch lookups so that latter lookups can refer to former lookups.
Thanks Anssi Kääriäinen and Tim Graham for the reviews. Refs #17001 and #22650.
2014-05-21 10:30:48 +07:00
Loic Bistuer bdf3473e64 Fixed #22650 -- Fixed regression on prefetch_related.
Regression from f51c1f59 when using select_related then prefetch_related
on the reverse side of an O2O:

Author.objects.select_related('bio').prefetch_related('bio__books')

Thanks Aymeric Augustin for the report and tests. Refs #17001.
2014-05-21 10:26:04 +07:00
Ramiro Morales 862e1ff234 Fixed #22421 -- Regression in fixtures loading.
Loading fixtures were failing since the refactoring in 244e2b71f5 for
inheritance setups where the chain contains abstract models and the
root ancestor contains a M2M relation.

Thanks Stanislas Guerra for the report.

Refs #20946.
2014-05-17 17:36:45 -03:00
Marc Tamlyn a2dd618e3b Fixed #22648 -- Transform.output_type should respect overridden custom_lookup and custom_transform.
Previously, class lookups from the output_type would be used, but any
changes to custom_lookup or custom_transform would be ignored.
2014-05-17 12:26:15 +02:00
Florian Apolloner 11932e978f Merge pull request #2346 from Markush2010/ticket21905
Fixed #21905 -- Add info message if DateField or TimeField use a fixed value
2014-05-17 12:09:04 +02:00