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