Commit Graph

678 Commits

Author SHA1 Message Date
Loic Bistuer a2814846ca Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
Baptiste Mispelon 621c25c419 Added missing deconstruct() methods. 2013-12-06 15:23:34 +01:00
Baptiste Mispelon 54d9e3ccf6 Fixed error in ManyToManyField.deconstruct(). 2013-12-06 15:22:52 +01:00
Andrew Godwin df800b1609 Add clone() method to Field to get clean copies of it. 2013-12-04 13:55:45 +00:00
Loic Bistuer 91fce675a4 Use 'update_fields' in RelatedManager.clear() when bulk=False.
Thanks Simon Charette for the suggestion.

Refs #21169.
2013-11-29 03:01:08 +07:00
Christopher Medrela 7477a4ffde Fixed E125 pep8 warnings 2013-11-28 08:50:11 -05:00
Loic Bistuer f450bc9f44 Added a bulk option to RelatedManager remove() and clear() methods
Refs #21169
2013-11-27 19:45:22 +02:00
Anssi Kääriäinen 52015b963d Used simpler queries for m2m clearing when possible.
Refs #21169
2013-11-27 19:45:05 +02:00
Loic Bistuer 17c3997f68 Fixed #21169 -- Reworked RelatedManager methods use default filtering
The `remove()` and `clear()` methods of the related managers created by
`ForeignKey`, `GenericForeignKey`, and `ManyToManyField` suffered from a
number of issues. Some operations ran multiple data modifying queries without
wrapping them in a transaction, and some operations didn't respect default
filtering when it was present (i.e. when the default manager on the related
model implemented a custom `get_queryset()`).

Fixing the issues introduced some backward incompatible changes:

- The implementation of `remove()` for `ForeignKey` related managers changed
  from a series of `Model.save()` calls to a single `QuerySet.update()` call.
  The change means that `pre_save` and `post_save` signals aren't called anymore.

- The `remove()` and `clear()` methods for `GenericForeignKey` related
  managers now perform bulk delete so `Model.delete()` isn't called anymore.

- The `remove()` and `clear()` methods for `ManyToManyField` related
  managers perform nested queries when filtering is involved, which may
  or may not be an issue depending on the database and the data itself.

Refs. #3871, #21174.

Thanks Anssi Kääriäinen and Tim Graham for the reviews.
2013-11-27 19:44:18 +02:00
Loic Bistuer cb83448891 Fixed #21410 -- prefetch_related() for ForeignKeys with related_name='+'
Regression introduced by commit 9777442.

Thanks to trac username troygrosfield for the report and test case.
2013-11-13 07:35:34 +02: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
coagulant 3bc0d46a84 Fixed all E261 warnings 2013-11-02 18:20:39 -04:00
Alex Gaynor 7548aa8ffd More attacking E302 violators 2013-11-02 13:12:09 -07:00
Tim Graham 36ded01527 Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
Alasdair Nicol dfb4cb9970 Fixed #21285 -- Fixed E121,E122 pep8 warnings 2013-10-17 20:20:11 -04:00
Aymeric Augustin 570d9c2678 Fixed #19560 -- Identified field in warning for naive datetime.
Thanks gcc for the report and vajrasky for the patch.
2013-10-13 11:54:11 +02:00
Tim Graham b67ab75e82 Fixed assorted flake8 errors. 2013-10-11 07:25:14 -04:00
Anssi Kääriäinen 1df3c49a1a Fixed #21174 -- transaction control in related manager methods 2013-10-05 23:07:52 +03:00
Simon Charette 948d209ada Fixed #21217 -- Avoid connecting `(pre|post)_init` signals to abstract senders. 2013-10-04 16:23:06 -04:00
Simon Charette fa2e1371cd Fixed #21216 -- Allow `OneToOneField` reverse accessor to be hidden. 2013-10-03 13:20:05 -04:00
Loic Bistuer d847ddfe1d Fixed #3871 -- Fixed regression introduced by 04a2a6b.
Added do_not_call_in_templates=True attribute to RelatedManagers
to prevent them from being called.

Thanks jbg@ for the report.
2013-09-30 15:43:44 -04:00
Russell Keith-Magee 9595183d03 Fixed #13724: Corrected routing of write queries involving managers.
Previously, if a database request spanned a related object manager, the
first manager encountered would cause a request to the router, and this
would bind all subsequent queries to the same database returned by the
router. Unfortunately, the first router query would be performed using
a read request to the router, resulting in bad routing information being
used if the subsequent query was actually a write.

This change defers the call to the router until the final query is acutally
made.

It includes a small *BACKWARDS INCOMPATIBILITY* on an edge case - see the
release notes for details.

Thanks to Paul Collins (@paulcollinsiii) for the excellent debugging
work and patch.
2013-09-30 13:05:43 +08:00
Erik Romijn 1a63092981 Fixed #20439 -- Started deprecation of IPAddressField 2013-09-28 10:55:32 +02:00
Loic Bistuer 04a2a6b0f9 Fixed #3871 -- Custom managers when traversing reverse relations. 2013-09-25 21:15:59 +03:00
Anssi Kääriäinen 50633e7353 Fixed #12568 -- no error when accessing custom field's descriptor
The SubfieldBase's descriptor caused an AttributeError when accessed
from the class. Introspection didn't like that.

Patch by Trac alias supervacuo.
2013-09-18 10:03:52 +03:00
Tim Graham 18ffdb1772 Fixed #17627 -- Renamed util.py files to utils.py
Thanks PaulM for the suggestion and Luke Granger-Brown and
Wiktor Kołodziej for the initial patch.
2013-09-16 12:52:05 -04:00
Aymeric Augustin 31e16c1343 Negligible style fix. 2013-09-07 13:48:37 -05:00
Chris Wilson eade315da1 Fixed #10164 -- Made AutoField increase monotonically on SQLite
Thanks malte for the report.
2013-09-06 12:31:17 -04:00
Carl Meyer 7211741fc5 Fixed #20999 - Allow overriding formfield class with choices, without subclass restrictions.
Refs #18162. Thanks claudep and mjtamlyn for review.
2013-08-30 17:43:10 -06:00
Tim Graham c7d0ff0cad Fixed #20989 -- Removed explicit list comprehension inside dict() and tuple()
Thanks jeroen.pulles at redslider.net for the suggestion and
helper script.
2013-08-29 12:11:03 -04:00
Tim Graham f19a3669b8 Fixed #14786 -- Fixed get_db_prep_lookup calling get_prep_value twice if prepared is False.
Thanks homm for the report and Aramgutang and lrekucki for work on
the patch.
2013-08-29 11:13:34 -04:00
Anssi Kääriäinen 244e2b71f5 Fixed #20946 -- model inheritance + m2m failure
Cleaned up the internal implementation of m2m fields by removing
related.py _get_fk_val(). The _get_fk_val() was doing the wrong thing
if asked for the foreign key value on foreign key to parent model's
primary key when child model had different primary key field.
2013-08-21 22:32:04 +01:00
Anssi Kääriäinen f5552571dc Fixed #20820 -- Model inheritance + m2m fixture loading regression
Tests by Tim Graham, report from jeroen.pulles@redslider.net.
2013-08-21 22:31:50 +01: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
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
Tai Lee 31e6d58d46 Fixed #20348 -- Consistently handle Promise objects in model fields.
All Promise objects were passed to force_text() deep in ORM query code.
Not only does this make it difficult or impossible for developers to
prevent or alter this behaviour, but it is also wrong for non-text
fields.

This commit changes `Field.get_prep_value()` from a no-op to one that
resolved Promise objects. All subclasses now call super() method first
to ensure that they have a real value to work with.
2013-07-31 15:54:17 +03:00
Julien Phalip 47c755327b Fixed a number of minor misspellings. 2013-07-27 18:46:03 -07:00
Anssi Kääriäinen 7cca8d56d2 Fixed related model lookup regression
It has been possible to use models of wrong type in related field
lookups. For example pigs__in=[a_duck] has worked. Changes to
ForeignObject broke that.

It might be a good idea to restrict the model types usable in lookups.
This should be done intentionally, not accidentally and without any
consideration for deprecation path.
2013-07-26 13:13:27 +03:00
ersran9 311c1d2848 Fixed #20761 -- Reworded ForeignKey default error message 2013-07-23 22:16:31 +02:00
Anssi Kääriäinen 6b4967e883 Minor change to get_extra_descriptor_filter()
Refs #20611.
2013-07-23 15:34:29 +03:00
Andrew Godwin 03ec3219a0 Merge branch 'master' into schema-alteration
Conflicts:
	django/db/backends/mysql/introspection.py
	django/db/backends/oracle/creation.py
	django/db/backends/postgresql_psycopg2/creation.py
	django/db/models/base.py
	django/db/models/loading.py
2013-07-22 19:04:25 +01:00
Tim Graham 2456ffa42c Fixed #20746 -- Removed Python 2.6 specific code/docs 2013-07-14 13:02:55 -04:00
Tim Graham f2cb94f1c0 Fixed #20740 -- GenericIPAddressField should pass protocol to formfield()
Thanks Jeff250.
2013-07-12 16:05:14 -04:00
Alex Gaynor 03d9566e0d A large number of stylistic cleanups across django/db/ 2013-07-08 10:39:54 +10:00
Andrew Godwin b1e0ec06f0 Merge branch 'master' into schema-alteration 2013-07-02 10:49:53 +01:00
Aymeric Augustin d5589b4cd3 Removed some conditional code only needed under Python 2.6. 2013-07-01 12:02:17 +02:00
Alex Gaynor b9ebca6a28 Removed a comment that wasn't adding a value.
In the intervening years, RelatedField has become less of a hack (though it still is one). Anyone who wants to can re-instate the comment, but please add more details.
2013-06-30 23:32:23 -07:00
Aymeric Augustin acd7b34aaf Advanced deprecation warnings for Django 1.7. 2013-06-29 18:49:37 +02:00
Claude Paroz ea3fe78a9d Fixed #20660 -- Do not try to delete an unset FieldFile
Thanks stanislas.guerra at gmail.com for the report and
Baptiste Mispelon for the review.
2013-06-29 18:08:39 +02:00
Andrew Godwin 904b82759c Fix Python 3 support 2013-06-28 17:53:49 +01:00
Andrew Godwin 7a47ba6f6a Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/backends/__init__.py
	django/db/models/fields/related.py
	tests/field_deconstruction/tests.py
2013-06-28 17:32:57 +01:00
Andrew Godwin 48dd1e63bb Ported over Field.deconstruct() from my schema alteration branch.
This is to help other ongoing branches which would benefit from
this functionality.
2013-06-28 17:27:52 +01:00
Andrew Godwin 99b467f272 Add related_query_name to ForeignKey/M2M. Refs #20244 2013-06-27 14:44:21 +01:00
Andrew Godwin 48493cff73 Remove EmailField max_length default removal in deconstruct() 2013-06-22 12:56:37 +01:00
Andrew Godwin 9daf81b94e Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/models/loading.py
2013-06-19 12:05:23 +01:00
Loic Bistuer ee77d4b253 Fixed #20199 -- Allow ModelForm fields to override error_messages from model fields 2013-06-18 08:01:17 -04:00
Loic Bistuer f34cfec0fa Refactored ValidationError to allow persisting error params and error codes as the exception bubbles up 2013-06-18 08:01:17 -04:00
Baptiste Mispelon dc9c359546 Fixed #20594 -- Add validation to models.SlugField.
Thanks carbonXT for the report.
2013-06-13 13:31:57 -04:00
Andrew Godwin 3c296382b8 Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/models/fields/related.py
2013-06-07 11:15:34 +01:00
Dan Loewenherz 07a73a2714 Fixed #20337 -- Clarified error message when database relation is not allowed. 2013-06-01 07:55:49 -04:00
Tim Graham 6f8627dd7f Fixed #17582 - Added message to DoesNotExist exceptions.
Thanks simon@ for the suggestion and JordanPowell
for the initial patch.
2013-05-27 07:57:06 -04:00
Ramiro Morales 4ba1c2e785 Fixed #9321 -- Deprecated hard-coding of help text in model ManyToManyField fields.
This is backward incompatible for custom form field/widgets that rely
on the hard-coded 'Hold down "Control", or "Command" on a Mac, to select
more than one.' sentence.

Application that use standard model form fields and widgets aren't
affected but need to start handling these help texts by themselves
before Django 1.8.

For more details, see the related release notes and deprecation timeline
sections added with this commit.
2013-05-20 16:29:51 -03:00
Anssi Kääriäinen c9a96075fa Fixed #20378 -- regression in GenericRelation on abstract model
When a GenericRelation was defined on abstract model, queries on childs
of the abstract model didn't work. The problem was in the way fields and
in particular field.rel was copied from models to their children.

The regression was likely caused by #19385. Thanks to Gavin Wahl for
spotting the regression.
2013-05-20 18:02:10 +03:00
Andrew Godwin 028bbd15ca Add a deconstruct() method to Fields.
This allows the field's initial argument to be obtained so it can be
serialised to, and re-created from, a textual format.
2013-05-18 13:48:57 +02:00
Andrew Godwin b31eea069c Merge branch 'master' into schema-alteration 2013-05-18 10:21:31 +02:00
Aymeric Augustin 9c487b5974 Replaced an antiquated pattern.
Thanks Lennart Regebro for pointing it out.
2013-05-17 18:08:58 +02:00
Andrew Godwin cb4b0de49e Merge branch 'master' into schema-alteration 2013-05-10 12:55:30 +01:00
Andrew Godwin 75bf394d86 Rest of the _meta.app_cache stuff. Schema tests work now. 2013-05-09 15:59:26 +01:00
Andrew Godwin 941d23e548 Whoops. Need to be good and use six. 2013-05-09 14:13:15 +01:00
Andrew Godwin ade34c44da Improve error message for bad FK resolution 2013-05-09 14:04:07 +01:00
Mike Fogel a22e15effc Remove unnecessary check on __set__ parameters. 2013-05-07 21:50:59 -07:00
Andrew Godwin 7f3678dc4c Merge branch 'master' into schema-alteration
Conflicts:
	django/db/backends/__init__.py
	django/db/backends/mysql/base.py
	django/db/backends/oracle/base.py
	django/db/backends/oracle/creation.py
	django/db/backends/postgresql_psycopg2/base.py
	django/db/backends/sqlite3/base.py
	django/db/models/fields/related.py
2013-04-18 17:16:39 +01:00
Simon Charette 216580e034 Fixed #20207 -- Handle ManyToManyField with a unicode name correctly. 2013-04-05 15:09:53 -04:00
Simon Charette 8d05e6c0c7 Fixed deprecation warnings introduced by 97774429ae. 2013-04-01 17:32:09 -04:00
Anssi Kääriäinen 0e0eb8a955 Fixed field.rel.field_name handling
This is a regression fix to multicolumn joins. Refs #19385.
2013-03-24 20:59:56 +02:00
Anssi Kääriäinen 9572a3992b Python 2.6 compatibility for #19385 2013-03-24 19:00:24 +02:00
Anssi Kääriäinen 97774429ae Fixed #19385 again, now with real code changes
The commit of 266de5f9ae included only
tests, this time also code changes included...
2013-03-24 18:40:40 +02: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
Marc Tamlyn 829dc3c5a6 Fixed #20094 - Be more careful when checking for Iterator
Python 2.6 has some different behaviour when checking
isinstance(foo, collections.Iterator).
2013-03-22 17:31:29 +01:00
Anssi Kääriäinen f403653cf1 Fixed #19635 -- Made fields pickleable 2013-03-17 15:32:50 +02:00
Aymeric Augustin 3beabb5afd Merge pull request #902 from evildmp/BLANK_CHOICE_NONE
Fixed #20043 -- Removed unused BLANK_CHOICE_NONE
2013-03-17 03:15:49 -07:00
Daniele Procida a4c9a4a5fe removed unused BLANK_CHOICE_NONE 2013-03-13 21:26:15 +00:00
Anssi Kääriäinen d744c550d5 Fixed #19964 -- Removed relabel_aliases from some structs
Before there was need to have both .relabel_aliases() and .clone() for
many structs. Now there is only relabeled_clone() for those structs
where alias is the only mutable attribute.
2013-03-12 21:33:47 +02: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 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 22be90dd17 Fixed #19989 -- Suppressed UnicodeWarning during BinaryField validation
Thanks Aymeric Augustin for the report and Simon Charette for the
review.
2013-03-06 08:30:23 +01:00
Claude Paroz d680a3f447 Added support for serializing BinaryField 2013-03-02 10:29:02 +01: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
Aymeric Augustin e76147a83a Fixed #19634 -- Added proper __hash__ methods.
Classes overriding __eq__ need a __hash__ such that equal objects have
the same hash.

Thanks akaariai for the report and regebro for the patch.
2013-02-25 23:05:20 +01:00
Tomek Paczkowski b6f4a92ff4 Proposed fix for #18162. 2013-02-23 19:01:38 +01:00
Tomek Paczkowski 3dddbc0f23 Fixed #19816: pre-evaluate queryset on m2m set
In ReverseManyRelatedObjectsDescriptor.__set__, evaluate possible
queryset to avoid problems when clear() would touch data this queryset
returns.
2013-02-23 15:50:33 +01:00
Anssi Kääriäinen 09fcb70c80 Fixed empty strings + to_field regression on Oracle
Querying the reverse side of nullable to_field relation, where both
sides can contain null values resulted in incorrect results. The reason
was not detecting '' as NULL.

Refs #17541
2013-02-23 00:05:31 +02: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
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
Simon Charette ec469ade2b Fixed #19689 -- Renamed `Model._meta.module_name` to `model_name`. 2013-02-05 04:16:07 -05:00
Anssi Kääriäinen 55da775ce1 Fixed #17541 -- Fixed non-saved/nullable fk querying 2013-01-08 21:02:38 +02:00
Aymeric Augustin 07fbc6ae0e Fixed #19547 -- Caching of related instances.
When &'ing or |'ing querysets, wrong values could be cached, and crashes
could happen.

Thanks Marc Tamlyn for figuring out the problem and writing the patch.
2013-01-02 22:21:46 +01:00
Anssi Kääriäinen 4511aeb6b8 Moved join path generation to Field
Refs #19385
2012-12-30 11:19:19 +02:00
Aymeric Augustin db278c3bf9 Fixed #19525 -- Reverted dcd4383107 and 05d333ba3b.
Refs #9893, #18515.

Thanks Russell for the report.
2012-12-27 09:37:57 +01:00
Andrew Godwin b62e82365a Merge remote-tracking branch 'core/master' into schema-alteration
Conflicts:
	django/db/models/loading.py
	django/db/models/options.py
2012-12-18 09:02:07 +00:00
Mike Johnson 088f68252d use six.string_types for python3 2012-11-04 14:16:32 -08:00
Mike Johnson fcd3d4c68f model_split: Fixed #19236 - fixed error for abstract models with a split method 2012-11-04 13:43:54 -08:00
Anssi Kääriäinen 68847135bc Removed dupe_avoidance from sql/query and sql/compiler.py
The dupe avoidance logic was removed as it doesn't seem to do anything,
it is complicated, and it has nearly zero documentation.

The removal of dupe_avoidance allowed for refactoring of both the
implementation and signature of Query.join(). This refactoring cascades
again to some other parts. The most significant of them is the changes
in qs.combine(), and compiler.select_related_descent().
2012-10-31 08:19:44 +02:00
Anssi Kääriäinen 611c4d6f1c Fixed #18823 -- Ensured m2m.clear() works when using through+to_field
There was a potential data-loss issue involved -- when clearing
instance's m2m assignments it was possible some other instance's
m2m data was deleted instead.

This commit also improved None handling for to_field cases.
2012-10-28 17:31:35 +02:00
Andrew Godwin 6a632e0457 Merge branch 'master' into schema-alteration
Conflicts:
	django/db/backends/__init__.py
	django/db/models/fields/related.py
	django/db/models/options.py
2012-10-26 08:41:13 +01:00
Aymeric Augustin 0a0fe8f71d Fix exception message from 3190abcd. Refs #18153.
Thanks Preston Holmes.
2012-10-09 22:06:55 +02:00
Aymeric Augustin 3190abcd75 Fixed #18153 -- Reverse OneToOne lookups on unsaved instances.
Thanks David Hatch and Anssi Kääriäinen for their inputs.
2012-10-09 21:36:35 +02:00
Russell Keith-Magee 43530384b7 Fixed #19049 -- Corrected dumb logic negation error from earlier patch. 2012-10-03 09:14:55 +08:00
Russell Keith-Magee 3b6f980bed Fixed #19049 -- Ensure that swapped models aren't included in reverse field caches.
Thanks to Ivan Virabyan for the report.
2012-10-02 22:52:45 +08:00
Adrien Lemaire 2c8267bf3d Fixed #17899 -- Rewrote [Ee]-mail to [Ee]mail 2012-09-26 14:14:51 +02:00
Russell Keith-Magee 70a0de37d1 Fixed #3011 -- Added swappable auth.User models.
Thanks to the many people that contributed to the development and review of
this patch, including (but not limited to) Jacob Kaplan-Moss, Anssi
Kääriäinen, Ramiro Morales, Preston Holmes, Josh Ourisman, Thomas Sutton,
and Roger Barnes, as well as the many, many people who have contributed to
the design discussion around this ticket over many years.

Squashed commit of the following:

commit d84749a0f0
Merge: 531e771 7c11b1a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Wed Sep 26 18:37:04 2012 +0800

    Merge remote-tracking branch 'django/master' into t3011

commit 531e7715da
Merge: 29d1abb 1f84b04
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Wed Sep 26 07:09:23 2012 +0800

    Merged recent trunk changes.

commit 29d1abbe35
Merge: 8a527dd 54c81a1
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Mon Sep 24 07:49:46 2012 +0800

    Merge remote-tracking branch 'django/master' into t3011

commit 8a527dda13
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Mon Sep 24 07:48:05 2012 +0800

    Ensure sequences are reset correctly in the presence of swapped models.

commit e2b6e22f29
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 23 17:53:05 2012 +0800

    Modifications to the handling and docs for auth forms.

commit 98aba856b5
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 23 15:28:57 2012 +0800

    Improved error handling and docs for get_user_model()

commit 0229209c84
Merge: 6494bf9 8599f64
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 23 14:50:11 2012 +0800

    Merged recent Django trunk changes.

commit 6494bf91f2
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Mon Sep 17 21:38:44 2012 +0800

    Improved validation of swappable model settings.

commit 5a04cde342
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Mon Sep 17 07:15:14 2012 +0800

    Removed some unused imports.

commit ffd535e413
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 20:31:28 2012 +0800

    Corrected attribute access on for get_by_natural_key

commit 913e1ac84c
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 20:12:34 2012 +0800

    Added test for proxy model safeguards on swappable models.

commit 280bf19e94
Merge: dbb3900 935a863
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 18:16:49 2012 +0800

    Merge remote-tracking branch 'django/master' into t3011

commit dbb3900775
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 18:09:27 2012 +0800

    Fixes for Python 3 compatibility.

commit dfd72131d8
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 15:54:30 2012 +0800

    Added protection against proxying swapped models.

commit abcb027190
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 15:11:10 2012 +0800

    Cleanup and documentation of AbstractUser base class.

commit a9491a8776
Merge: fd8bb4e 08bcb4a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 14:46:49 2012 +0800

    Merge commit '08bcb4aec1ed154cefc631b8510ee13e9af0c19d' into t3011

commit fd8bb4e3e4
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 14:20:14 2012 +0800

    Documentation improvements coming from community review.

commit b550a6d06d
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 13:52:47 2012 +0800

    Refactored skipIfCustomUser into the contrib.auth tests.

commit 52a02f1110
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 13:46:10 2012 +0800

    Refactored common 'get' pattern into manager method.

commit b441a6bbc7
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 16 13:41:33 2012 +0800

    Added note about backwards incompatible change to admin login messages.

commit 08bcb4aec1
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Sep 15 18:30:33 2012 +0300

    Splitted User to AbstractUser and User

commit d9f5e5addb
Author: Anssi Kääriäinen <akaariai@gmail.com>
Date:   Sat Sep 15 18:30:02 2012 +0300

    Reworked REQUIRED_FIELDS + create_user() interaction

commit 579f152e4a
Merge: 9184972 93e6733
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sat Sep 15 20:18:37 2012 +0800

    Merge remote-tracking branch 'django/master' into t3011

commit 918497218c
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sat Sep 15 20:18:19 2012 +0800

    Deprecate AUTH_PROFILE_MODULE and get_profile().

commit 334cdfc1bb
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sat Sep 15 20:00:12 2012 +0800

    Added release notes for new swappable User feature.

commit 5d7bb22e8d
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sat Sep 15 19:59:49 2012 +0800

    Ensure swapped models can't be queried.

commit 57ac6e3d32
Merge: f2ec915 abfba3b
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sat Sep 15 14:31:54 2012 +0800

    Merge remote-tracking branch 'django/master' into t3011

commit f2ec915b20
Merge: 1952656 5e99a3d
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 9 08:29:51 2012 +0800

    Merge remote-tracking branch 'django/master' into t3011

commit 19526563b5
Merge: 2c5e833 c4aa26a
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 9 08:22:26 2012 +0800

    Merge recent changes from master.

commit 2c5e833a30
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 9 07:53:46 2012 +0800

    Corrected admin_views tests following removal of the email fallback on admin logins.

commit 20d1892491
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sun Sep 9 01:00:37 2012 +0800

    Added conditional skips for all tests dependent on the default User model

commit 40ea8b8882
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sat Sep 8 23:47:02 2012 +0800

    Added documentation for REQUIRED_FIELDS in custom auth.

commit e6aaf65970
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Sat Sep 8 23:20:02 2012 +0800

    Added first draft of custom User docs.

    Thanks to Greg Turner for the initial text.

commit 75118bd242
Author: Thomas Sutton <me@thomas-sutton.id.au>
Date:   Mon Aug 20 11:17:26 2012 +0800

    Admin app should not allow username discovery

    The admin app login form should not allow users to discover the username
    associated with an email address.

commit d088b3af58
Author: Thomas Sutton <me@thomas-sutton.id.au>
Date:   Mon Aug 20 10:32:13 2012 +0800

    Admin app login form should use swapped user model

commit 7e82e83d67
Merge: e29c010 39aa890
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Fri Sep 7 23:45:03 2012 +0800

    Merged master changes.

commit e29c010beb
Merge: 8e3fd70 30bdf22
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Mon Aug 20 13:12:57 2012 +0800

    Merge remote-tracking branch 'django/master' into t3011

commit 8e3fd703d0
Merge: 507bb50 26e0ba0
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Mon Aug 20 13:09:09 2012 +0800

    Merged recent changes from trunk.

commit 507bb50a92
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Mon Jun 4 20:41:37 2012 +0800

    Modified auth app so that login with alternate auth app is possible.

commit dabe362836
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Mon Jun 4 20:10:51 2012 +0800

    Modified auth management commands to handle custom user definitions.

commit 7cc0baf89d
Author: Russell Keith-Magee <russell@keith-magee.com>
Date:   Mon Jun 4 14:17:28 2012 +0800

    Added model Meta option for swappable models, and made auth.User a swappable model
2012-09-26 18:48:09 +08:00
Andrew Godwin ca9c3cd39f Add check constraint support - needed a few Field changes 2012-09-07 15:40:59 -04:00
Claude Paroz 306d34873c Fixed #18212 -- Standardized arguments of GenericIPAddressField
Unlike other model fields, the newly introduced (1.4)
GenericIPAddressField did not accept verbose_name and name as the
first positional arguments. This commit fixes it.
Thanks Dan McGee for the report and the patch.
2012-09-01 18:38:55 +02:00
Claude Paroz ae88e73fa6 Replaced some smart_xxx by force_xxx equivalent
smart_str/smart_text should only be used when a potential lazy
string should be preserved in the result of the function call.
2012-08-30 15:46:16 +02:00
Aymeric Augustin e091c18f50 [py3] Removed a remaining use of __metaclass__. 2012-08-14 23:45:12 +02:00
Claude Paroz 9cb80356fc [py3] Fed strftime with unicode on Python 3 2012-08-14 16:19:58 +02:00
Alex Gaynor 4c97101b1f remove a bunch of unnescesarry iterkeys() calls 2012-08-08 07:33:15 -07:00
Aymeric Augustin 12cda89ffe [py3] Fixed a loop that changed dictionary size. 2012-08-08 15:00:24 +02:00
Aymeric Augustin a8b3ddec5f [py3] Applied minor fixes so the test suite starts 2012-08-07 12:00:22 +02: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
Aymeric Augustin ee191715ea [py3] Fixed access to dict keys/values/items. 2012-08-07 12:00:22 +02:00
Brendan MacDonell ad237fb72f Fixed #18724 -- Fixed IntegerField validation with value 0 2012-08-06 10:42:21 +02:00
Aymeric Augustin bdca5ea345 [py3] Replaced unicode/str by six.text_type/bytes. 2012-07-22 09:29:54 +02:00
Aymeric Augustin 3cb2457f46 [py3] Replaced basestring by six.string_types. 2012-07-22 09:29:54 +02:00
Claude Paroz 05d333ba3b Fixed #18515 -- Conditionally regenerated filename in FileField validation
When a FileField value has been saved, a new validation should not
regenerate a new filename when checking the length. Refs #9893.
2012-06-26 18:18:44 +02:00
Jann Kleen 1a412dda62 Fixed #18432 -- Prevented the ForeignKey field from creating an invalid query when chained. Thanks, Jann Kleen. 2012-06-07 18:49:19 +02:00
Claude Paroz 4a103086d5 Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and
Jannis Leidel for the review.
2012-06-07 18:08:47 +02:00
Luke Plant f5ce1793a8 Small cleanup in prefetch_related code 2012-06-06 14:19:06 +01:00
Luke Plant 4fea46a030 Fixed #18309 - Prefetch related does not work for fkey to multitable inherited model
Thanks to milosu for the report, tests and initial patch.
2012-06-06 14:17:32 +01:00
Aymeric Augustin 939af5a654 Fixed a typo in a comment. Refs #17742. 2012-06-01 08:09:58 +02:00
Claude Paroz 0dc904979d Fixed #18407 -- Made model field's to_python methods fully accept unicode.
When generating error message in to_python, any unicode string
containing non-ascii characters triggered a UnicodeEncodeError for
most field types.
2012-05-31 16:46:07 +02:00
Aymeric Augustin 1e6c3368f2 Fixed #18177 -- Cached known related instances.
This was recently fixed for one-to-one relations; this patch adds
support for foreign keys. Thanks kaiser.yann for the report and
the initial version of the patch.
2012-05-24 13:25:01 +02:00
Claude Paroz df7a65ac4b Replaced 'next' testing by collections.Iterator testing.
The new construct is also Python 3 compatible (where 'next' has
been renamed to '__next__').
2012-05-22 20:37:38 +02:00
Aymeric Augustin dcd4383107 Fixed #9893 -- Validated the length of file names
after the full file name is generated by the storage class.

Thanks Refefer for the report, carsongee for the patch, and
everyone else involved in the discussion.
2012-05-17 16:02:05 +02:00
Simon Charette 5cbfb48b92 Made model fields comparable to other objects
Fixed #17851 -- Added __lt__ and @total_ordering to models.Field,
made sure these work correctly on other objects than Field, too.
2012-05-07 20:08:20 +03:00
Aymeric Augustin 46b082e05c Fixed #17742 -- Handled aware datetimes in DateField
Converted aware datetimes to the default time zone before using them
in the context of a DateField.
2012-05-01 11:29:55 +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
Anssi Kääriäinen c4e62eff90 Fixed #17653 -- Changed MySQL backend to raise a ValueError if zero is used as an AutoField value.
Thanks to Sylvain Lebon for the report, krzysiumed for the patch and charettes and claudep for reviews.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@17933 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-24 18:03:14 +00: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
Claude Paroz 2cd516002d Fixed #18002 -- Fixed typo in attribute name in ReverseSingleRelatedObjectDescriptor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17904 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-12 20:23:41 +00:00
Aymeric Augustin b90d4e5b74 Made the caching of related and reverse related objects consistent in OneToOneFields. Fixed #13839. Refs #17439.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17890 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-10 12:29:25 +00:00
Aymeric Augustin 1f11069aa5 Fixed #18090 -- Applied filters when running prefetch_related backwards through a one-to-one relation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17888 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-10 06:04:53 +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
Luke Plant 3db5b0e485 Fixed #17696 - Queryset prefetch_related() ignores using()
Thanks to simon29 for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17605 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-01 00:57:01 +00:00
Jannis Leidel 2aae057727 Fixed #17219 -- Updated model field descriptions to be more precise. Thanks, charettes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17476 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-09 18:57:54 +00:00
Jannis Leidel 2b0c1ea641 Fixed #17527 -- Improved exception message when adding the wrong type of object to a ManyToManyField. Thanks, guettli and cClaude Paroz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17437 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-04 16:06:09 +00:00
Jannis Leidel 0907233040 Added a missing warning forgotten in r17392.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-24 10:32:28 +00:00
Jannis Leidel 8f168976d6 Fixed #17580 -- Made sure datetime.date instances are correctly handled when being passed to a DateTimeField fields and the timezone support is enabled by making it aware using the default timezone.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17392 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-24 10:00:39 +00:00
Aymeric Augustin 866c229f52 Fixed #17294 -- Supported nullable DateTimeFields when time zone support is enabled. Thanks pressureman for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17148 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-25 09:25:43 +00:00
Aymeric Augustin 9c30d48b45 Fixed #17263 -- Added a warning when a naive datetime reaches the database layer while time zone support is enabled.
After this commit, timezones.AdminTests will raise warnings because the sessions contrib app hasn't been upgraded to support time zones yet.
This will be fixed in an upcoming commit.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@17117 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-19 23:27:20 +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
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
Aymeric Augustin 06d9b82a27 Fixed #16906 -- Format datetimes with str/unicode instead of strftime where possible: it's faster and it works for all dates.
Also ensured that datetime_safe is used wherever strftime is called on dates/datetimes that may be before 1900.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@16978 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-13 19:23:45 +00:00
Julien Phalip c58e5724bc Fixed a couple of `assert` syntax warnings mistakingly introduced in r16966 and added some tests to prevent future regressions. Thanks to Anssi Kääriäinen for the report.
Refs #12467.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-13 11:53:59 +00:00
Julien Phalip 3b22c68343 Fixed #12467 -- Made the model data validation for `DateField` and `DateTimeField` more useful by actually telling what was the value that failed. Also did a bit of PEP8 cleanup in the area. Thanks to knutin for the report, to raulcd for the initial patch and to charettes for the review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16966 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-13 08:11:00 +00:00
Luke Plant d5803bb5fb More efficient IN clauses for prefetch_related queries by use of sets to eliminate duplicates
This simply reduces the size of the IN clause in the SQL, which can be
significant in some cases.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16944 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-08 13:50:29 +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 b763412aa4 Removed ForeignRelatedObjectsDescriptor.RelatedManager.delete_manager, which has been unused since [14507]
And cleaned up the result, allowing more consistency with the other related
descriptors.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16931 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-06 11:08:11 +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
Luke Plant 5009e45dfe Fixed #14270 - related manager classes should be cached
Thanks to Alex Gaynor for the report and initial patch, and mrmachine for
more work on it.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16916 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-30 10:41:25 +00:00
Luke Plant 6d6fe61bf6 Cleanups to related manager code, especially in use of closures.
The related manager classes are defined within functions, and the methods
had inconsistent and confusing usage of closures vs. parameters on self to
retrieve needed information. Everything is stored on self now.

Also some methods were not using super() where they should have been.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16913 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-29 15:30:29 +00:00
Luke Plant e3a6ac8f60 Small cleanups of 'related manager' code for consistency
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-29 15:30:19 +00:00
Luke Plant 29b8e34dfb Removed unused parameter 'join_table' in various bits of RelatedManager code
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16907 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-26 17:20:20 +00:00
Russell Keith-Magee 5f287f75f2 Altered the behavior of URLField to avoid a potential DOS vector, and to avoid potential leakage of local filesystem data. A security announcement will be made shortly.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16760 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-10 00:47:00 +00:00
Alex Gaynor 7deb25b8dd Fixed #7596. Added Model.objects.bulk_create, and make use of it in several places. This provides a performance benefit when inserting multiple objects. THanks to Russ for the review, and Simon Meers for the MySQl implementation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16739 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-09 19:22:28 +00:00
Malcolm Tredinnick 587fbff3dd Make ManyToManyField model references more robust.
In r16679 a test was added to verify something had been fixed when a
unicode string type was passed in as a model name. The name has to be
ASCII convertible, but in Python 2.6 and earlier, it must also have str
type.

This commit fixes the problem for earlier Python versions and is almost
identical to a patch from b.leskes in #6045.

Fixes #16689. Refs #6045.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16682 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-25 06:07:28 +00:00
Malcolm Tredinnick 1f770c62da Fix initialisation of ImageField super classes.
Fixes #16548, with thanks to pyriku.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16658 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-23 04:05:47 +00:00
Malcolm Tredinnick c471d471bf Improved error message display during validation errors.
When reporting a validation error (during model validation or fixture
loading, for example), the error messages now report the bad value as
well as the expected type. This can make identifying the offending field
and problem a bit easier.

Fixed #11595. Patch from raulcd and wildfire with supervision from
Russell.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16638 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-22 00:48:53 +00:00
Jannis Leidel 1abafe696e Fixed #14695 -- Stopped model fields from incorrectly overwriting the field name during model initialization if it was already passed as a keyword argument. Thanks, erikrose and willhardy.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16614 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-13 11:53:42 +00:00
Jannis Leidel 1d485cf14f Fixed #10405 -- Raise a more useful error if the formfield of a related model field can't be created yet because the related model isn't loaded yet. Thanks ojii and charstring.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16604 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-08-12 14:15:08 +00:00
Jannis Leidel dc2bfae1e5 Fixed #16531 -- Fixed various instances of "undefined name" issues. Thanks, Bruno Renié.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16557 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-29 09:39:35 +00:00
Jannis Leidel 24f4764a48 Fixed #16225 -- Removed unused imports. Many thanks to Aymeric Augustin for the work on the patch and Alex for reviewing.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-13 09:35:51 +00:00
Jannis Leidel 823bac36db Fixed #16246 -- Fixed GenericIPAddressField tests on PostgreSQL.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16395 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-13 20:15:13 +00:00
Karen Tracey 13efd10465 Refs #16234: Avoid GenericIPAddressField clobbering Field default_error_messages dict.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16390 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-13 04:31:56 +00:00
Jannis Leidel ce3c281090 Fixed #811 -- Added support for IPv6 to forms and model fields. Many thanks to Erik Romijn.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16366 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-11 13:48:24 +00:00
Andrew Godwin 865d684a8a Fixed #8913 - Make "must be unique" error messages customisable. Thanks to Leah Culver.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16345 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-09 15:05:13 +00:00
Alex Gaynor fcf8312ade Made clear() on a reverse foreign key significantly more efficient. Thanks to Andrew Godwin for the review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16335 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-07 20:51:59 +00:00
Jannis Leidel 48cffd9e45 Fixed #5931 -- Added __repr__ to db fields. Thanks, Thomas Güttler, emulbreh and magopian.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16145 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-05-03 11:51:37 +00:00
Carl Meyer 6bdaef26ec Fixed #15866, #15850 -- Prevented get_model() and get_models() from returning not-installed models (by default). Thanks adsva for report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16053 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-20 17:58:37 +00:00
Russell Keith-Magee eea43f2458 Removed deprecated XMLField.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15982 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-02 08:39:52 +00:00
Alex Gaynor e57cc90c16 Removed deprecated legacy connection handling for `Field.get_db_*`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15958 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-30 17:48:42 +00:00
Adrian Holovaty 13864703bc Removed a bunch more Python 2.4 workarounds now that we don't support that version. Refs #15702 -- thanks to jonash for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15927 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-28 02:11:19 +00:00
Luke Plant 0a3aae8362 Fixed #15559 - distinct queries introduced by [15607] cause errors with some custom model fields
This patch just reverts [15607] until a more satisfying solution can be
found.

Refs #11707

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15791 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-10 01:15:19 +00:00
Russell Keith-Magee d1290b5b43 Fixed #3094 -- Accelerated deprecation of XMLField, since it hasn't served any useful purpose since oldforms. Thanks to PaulM for driving the issue and providing the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15723 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-03 13:28:20 +00:00
Luke Plant 6902824ac2 Fixed #11707 - limit_choices_to on a ForeignKey can render duplicate options in formfield
Thanks to Chris Wesseling for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15607 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-21 14:03:59 +00:00
Luke Plant c24bdf044b Fixed #15103 - SuspiciousOperation with limit_choices_to and raw_id_fields
Thanks to natrius for the report.

This patch also fixes some unicode bugs in affected code.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15347 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-28 14:08:25 +00:00
Carl Meyer 84291b7b84 Fixed #15161 - Corrected handling of ManyToManyField with through table using to_field on its ForeignKeys. Thanks to adehnert for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15330 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26 19:10:08 +00:00
Carl Meyer 00e7a571c5 Fixed #6456 - Excised FileField file deletion to avoid data loss. Thanks to durdinator for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15321 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-26 07:46:19 +00:00
Carl Meyer 227c5e80db Fixed #11319 - Added lookup support for ForeignKey.to_field. Also reverted no-longer-needed model formsets workaround for lack of such support from r10756. Thanks Russell and Alex for review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-25 03:14:28 +00:00
Ramiro Morales e1ede214e6 Fixed #13668 -- Corrected database router methods invocation for ManyToMany fields without through models. Thanks craig.kimerer for the report and David Gouldin for the fix.
This also adds tests for r14857.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15185 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-13 04:11:41 +00:00
Jannis Leidel 88ff656731 Fixed #12955 -- Use the size attribute of the file instead of len() to support uploads larger than 2GB. Thanks, swiedenroth and isagalaev.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14878 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-12 22:54:22 +00:00
Russell Keith-Magee 52c77803d2 Normalized the name order of arguments. There's no actual bug here, other than potential confusion for anyone reading the code. Thanks to Aram Dulyan for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14796 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-04 05:59:38 +00:00
Alex Gaynor fc47f8c65a Fixed #14257 -- removed ManyToManyField.isValidIDList which was completely dead code (unused since magic-removal). Thanks to andrewsk for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14602 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-17 17:00:40 +00:00
Ramiro Morales f3d0704783 Fixed #14691 -- Made ForeignKey.validate() use the right database. Thanks Marco Paolini for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14580 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-16 22:09:13 +00:00
Carl Meyer 616b30227d Fixed #7539, #13067 -- Added on_delete argument to ForeignKey to control cascade behavior. Also refactored deletion for efficiency and code clarity. Many thanks to Johannes Dollinger and Michael Glassford for extensive work on the patch, and to Alex Gaynor, Russell Keith-Magee, and Jacob Kaplan-Moss for review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14507 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-09 16:46:42 +00:00
Alex Gaynor 222c732616 Fixed #10728 -- corrected subclassing of Fields who use the SubfieldBase metaclass. Thanks to G2P and George Sakkis for their work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14443 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-02 18:40:53 +00:00
Russell Keith-Magee 8a724802c5 Fixed #14471 -- Corrected a regression in the use of methods on custom managers on related querysets. Thanks to Lucky for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14389 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-28 12:57:04 +00:00
Chris Beaven 65b98c9b41 Change the stacklevel for Field deprecation warnings to correctly point to the source of the problem
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-15 02:09:11 +00:00
Russell Keith-Magee 1070c57b83 Fixed #14436 -- Escalated 1.2 PendingDeprecationWarnings to DeprecationWarnings, and removed 1.1 deprecated code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14138 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-11 12:20:07 +00:00
Russell Keith-Magee a904e55859 Fixed #11509 -- Modified usage of "Web" to match our style guide in various documentation, comments and code. Thanks to timo and Simon Meers for the work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14069 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-09 08:12:50 +00:00
Jannis Leidel dbf23ef273 Fixed #10970 -- Initialize DateFields with datetime.date objects, not datetime.datetime. Thanks, summerisgone, Cyberj and Ramiro Morales.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-08 16:14:10 +00:00
Jannis Leidel 392d992f82 Fixed #7048 -- Added ClearableFileInput widget to clear file fields. Thanks for report and patch, jarrow and Carl Meyer.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13968 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-01 02:02:58 +00:00
Russell Keith-Magee 244e7b9334 Fixed #13516 -- Added an internal type definition for AutoFields, so that subclassed fields are handled correctly by the SQL generator. Thanks to manfre for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13540 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-07 07:38:27 +00:00
Russell Keith-Magee 7e06065d8b Fixed #13552 -- Added a 'using' parameter to database signals. Thanks to gmandx for the suggestion, and Andrew Godwin for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13538 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-07 06:27:52 +00:00
Russell Keith-Magee aa93f8c2f0 Fixed #13613 -- Ensure that forms.URLField and forms.EmailField are used on a modelform. This ensures that fields are URL and Email fields are cleaned consistently when included on model forms. Thanks to amadison for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13475 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-05 03:59:20 +00:00
Russell Keith-Magee 8b73acdf4d Fixed #13730 -- Removed the hard-coding of the requirement that ForeignKeys have an index. Thanks to Suor for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13452 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-07-30 02:55:20 +00:00
Russell Keith-Magee 5211f48ae3 Fixed #12164 -- Removed the Python 2.3 compatibility imports and workarounds. Thanks to timo and claudep for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-05-04 14:00:30 +00:00
Russell Keith-Magee 848fbdc3e7 Fixed #13432 -- Corrected the logic for router use on OneToOne fields; also added a bunch of tests for OneToOneField queries. Thanks to piquadrat for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13037 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-28 04:20:35 +00:00
Russell Keith-Magee dd07c23545 Fixed #12749 -- Corrected a problem with validation of inline primary keys. Thanks to Chris.Wesseling@cwi.nl for the report, and nessita for the test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13034 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-27 15:05:38 +00:00
Russell Keith-Magee dccc5ac0a6 Refs #13427 -- Removed translation from verbose_name and verbose_name_plural on autogenerated m2m models.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13031 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-27 14:42:55 +00:00
Russell Keith-Magee 2f9eef1227 Fixed #13407 -- Corrected verbose names for autogenerated m2m models, and cleaned up the default form prefix when an autogenerated m2m through model is used in a formset. Thanks to carljm for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-27 12:35:49 +00:00
Russell Keith-Magee 3fb57d47bd Fixed #13328 -- Ensured that querysets on models with callable defaults can be pickled. No, really this time. Thanks to Alex for his help brainstorming the solution.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13013 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-21 16:34:33 +00:00
Russell Keith-Magee cb906e1593 Fixed #13366 -- Corrected the field __setstate__ method to avoid a race condition when initially importing models. Thanks to Brett Hoerner for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13005 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-20 14:39:46 +00:00
Russell Keith-Magee 2cd48bac7e Fixed #13358 -- Ensured that db_manager() can be used to override database routing on M2M, reverse FK and generic key queries. Thanks to Craig Kimerer for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12993 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-16 12:29:23 +00:00
Russell Keith-Magee 2faa3acb4b Fixed #13328 -- Added a __getstate__/__setstate__ pair to fields so that callable default values aren't pickled. Thanks to bkonkle for the report, and Vitaly Babiy for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12977 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-15 12:41:08 +00:00
Russell Keith-Magee 5e5203c7d7 Fixed #11956 -- Modified the handling of m2m relationships between subclasses. Thanks to nidi for the report, and astoneman for the suggestion on how to fix the problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12908 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-02 15:44:48 +00:00
Russell Keith-Magee a75dc3406f Fixed #13250 -- Corrected a problem with the use of routing rules on the create() call on a Foreign Key. Thanks to chris@xlevus.net for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12895 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-31 12:33:10 +00:00
Russell Keith-Magee 273a002544 Fixed #13087 -- Modified m2m signals to provide greater flexibility over exactly when notifications are delivered.
This is a BACKWARDS INCOMPATIBLE CHANGE for anyone using the signal names introduced in r12223.

 * If you were listening to "add", you should now listen to "post_add".
 * If you were listening to "remove", you should now listen to "post_remove".
 * If you were listening to "clear", you should now listen to "pre_clear".

You may also want to examine your code to see whether the "pre_add", "pre_remove" or "post_clear" would be better suited to your application.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12888 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-30 11:54:56 +00:00
Russell Keith-Magee ad5afd6ed2 Fixed #12769, #12924 -- Corrected the pickling of curried and lazy objects, which was preventing queries with translated or related fields from being pickled. And lo, Alex Gaynor didst slayeth the dragon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12866 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-27 15:54:31 +00:00
Russell Keith-Magee b31b2d4da3 Fixed #13227 -- Modified ForeignKeys to fully honor the db_prep/prep separation introduced by multidb. This was required to ensure that model instances aren't deepcopied as a result of being involved in a filter clause. Thanks to claudep for the report, and Alex Gaynor for the help on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12865 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-27 15:16:27 +00:00
Karen Tracey 10884ec2eb Fixed #12239, again: Refined the original fix to avoid the test errors introduced. Thanks pmclanahan.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12821 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-20 20:01:06 +00:00
Karen Tracey 9150fb6b0c Fixed #12239: Fixed results of gte and lt queries when comparing floats to integer field values.
Thanks waverider, aroy, SmileyChris, and pmclanahan.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@12819 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-20 17:56:22 +00:00
James Bennett cccd106289 Forced blank=True for NullBooleanField to allow it to pass model validation with a value of None. Refs #13071.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12744 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-10 07:41:37 +00:00
Luke Plant bae921dcff Fixed #11940 - ModelForm evaluates callable default values on form class creation
Thanks to Harm Geerts for the report and initial patch.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@12721 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-08 15:03:30 +00:00
Joseph Kocherhans 686dac03b7 Fixed #12913. Fields with choices now respect show_hidden_initial as a keyword argument to formfield. Thanks, semenov.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12696 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-07 01:50:58 +00:00
James Bennett 98aecaa999 Fixed #13034: Corrected default error message for IntegerField.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12685 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-06 11:11:55 +00:00
Joseph Kocherhans 16fe73d918 Fixed #7190. Boolean fields now return bool values instead of 1 or 0. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12578 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-24 17:36:18 +00:00
Joseph Kocherhans 9f4bf525f8 Fixed #12546. Objects with a __len__ that returns 0 can now be serialized. Thanks, casobn for the report and Alex Gaynor for the patch and tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12576 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-24 15:54:03 +00:00
Joseph Kocherhans 7352238e16 Fixed a few more spots related to #11859. Thanks, cramm and Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12537 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 18:27:51 +00:00
Joseph Kocherhans 10b1871441 Fixed #12888. Fixed a typo in some related object error messages. Thanks, nessita.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23 16:09:39 +00:00
Russell Keith-Magee e6db084ac8 Fixed #11226 -- Corrected an validation edge case with m2m relations between two models with the same class name. Thanks to pkoch for the report, and to Ramiro Morales for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12489 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-22 14:04:13 +00:00
Joseph Kocherhans fbb42c31df Fixed #12667. Added optgroup validation support to model fields with choices. Thanks ramiro.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12374 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-02 00:41:28 +00:00
Russell Keith-Magee 58cd220f51 Fixed #7270 -- Added the ability to follow reverse OneToOneFields in select_related(). Thanks to George Vilches, Ben Davis, and Alex Gaynor for their work on various stages of this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12307 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-27 13:30:29 +00:00
Russell Keith-Magee 1b3dc8ad9a Fixed #12540, #12541 -- Added database routers, allowing for configurable database use behavior in a multi-db setup, and improved error checking for cross-database joins.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-22 14:30:06 +00:00
Joseph Kocherhans acc095c333 Fixed #12582. Model validation on ForeignKeys now respects limit_choices_to. Thanks, Honza Král.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12271 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-21 03:26:14 +00:00
Russell Keith-Magee 2b2db12032 Fixed #12386 -- Corrected the column names produced for autogenerated m2m tables when the related table is specified as a dot-separated string. Thanks to ldevesine for the report and simonb for the extra test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12226 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-14 14:55:36 +00:00
Russell Keith-Magee 6afd505b5b Fixed #5390 -- Added signals for m2m operations. Thanks to the many people (including, most recently, rvdrijst and frans) that have contributed to this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-13 11:07:16 +00:00
Joseph Kocherhans 2f9853b2dc Fixed #12512. Changed ModelForm to stop performing model validation on fields that are not part of the form. Thanks, Honza Kral and Ivan Sagalaev.
This reverts some admin and test changes from [12098] and also fixes #12507, #12520, #12552 and #12553.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12206 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-12 02:29:45 +00:00
Adrian Holovaty 5ceed0a053 Changed a whole bunch of places to raise exception instances instead of old-style raising exception classes plus a comma. Good for the future Python 3 conversion
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12180 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-10 18:36:20 +00:00
Adrian Holovaty 18723e6e24 Fixed #10015 -- PostgreSQL 8.3+ no longer barfs when passing an integer as a filter() value for a CharField or TextField. Thanks, carljm
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12150 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-09 22:05:10 +00:00
Jannis Leidel bacfe3f3e8 Fixed #9638 - Added %(app_label)s to the related_name format string for abstract models.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12139 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-09 20:03:52 +00:00
Jannis Leidel b7236b8576 Fixed #12059 - Let TimeField.to_python correctly return a datetime.time object when having a datetime object.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12137 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-09 20:02:41 +00:00
Joseph Kocherhans 33afa13af5 Fixed a call to .using() that didn't make it into one of the model-validation branch merges.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-05 15:39:42 +00:00
Joseph Kocherhans 471596fc1a Merged soc2009/model-validation to trunk. Thanks, Honza!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-05 03:56:19 +00:00
Russell Keith-Magee ff60c5f9de Fixed #1142 -- Added multiple database support.
This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project.
Congratulations to Alex for a job well done.

Big thanks also go to:
 * Justin Bronn for keeping GIS in line with the changes,
 * Karen Tracey and Jani Tiainen for their help testing Oracle support
 * Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback.
 * Malcolm Treddinick for his guidance during the GSoC submission process.
 * Simon Willison for driving the original design process
 * Cal Henderson for complaining about ponies he wanted.

... and everyone else too numerous to mention that helped to bring this feature into fruition.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22 15:18:51 +00:00
Jacob Kaplan-Moss 574eafe4c0 Fixed #11753 - Q objects with callables no longer explode on Python 2.4. Thanks, Jeremy Dunck.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11901 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-17 22:06:41 +00:00
Karen Tracey 5bd63663a9 Fixed #399: Added big integer field. Thanks to Tomáš Kopeček for persistently maintaining a patch for this.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11887 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-17 15:10:38 +00:00
Karen Tracey 833df0afaa Fixed #12385: Made built-in field type descriptions in admindocs translatable again. Many thanks to Ramiro for the problem report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11878 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-16 18:13:34 +00:00