summaryrefslogtreecommitdiff
path: root/django/db/models/fields
AgeCommit message (Collapse)Author
2012-08-07[py3] Ported django.utils.encoding.Aymeric Augustin
* 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[py3] Fixed access to dict keys/values/items.Aymeric Augustin
2012-08-06Fixed #18724 -- Fixed IntegerField validation with value 0Brendan MacDonell
2012-07-22[py3] Replaced unicode/str by six.text_type/bytes.Aymeric Augustin
2012-07-22[py3] Replaced basestring by six.string_types.Aymeric Augustin
2012-06-26Fixed #18515 -- Conditionally regenerated filename in FileField validationClaude Paroz
When a FileField value has been saved, a new validation should not regenerate a new filename when checking the length. Refs #9893.
2012-06-07Fixed #18432 -- Prevented the ForeignKey field from creating an invalid ↵Jann Kleen
query when chained. Thanks, Jann Kleen.
2012-06-07Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.Claude Paroz
Thanks Vinay Sajip for the support of his django3 branch and Jannis Leidel for the review.
2012-06-06Small cleanup in prefetch_related codeLuke Plant
2012-06-06Fixed #18309 - Prefetch related does not work for fkey to multitable ↵Luke Plant
inherited model Thanks to milosu for the report, tests and initial patch.
2012-06-01Fixed a typo in a comment. Refs #17742.Aymeric Augustin
2012-05-31Fixed #18407 -- Made model field's to_python methods fully accept unicode.Claude Paroz
When generating error message in to_python, any unicode string containing non-ascii characters triggered a UnicodeEncodeError for most field types.
2012-05-24Fixed #18177 -- Cached known related instances.Aymeric Augustin
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-22Replaced 'next' testing by collections.Iterator testing.Claude Paroz
The new construct is also Python 3 compatible (where 'next' has been renamed to '__next__').
2012-05-17Fixed #9893 -- Validated the length of file namesAymeric Augustin
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-07Made model fields comparable to other objectsSimon Charette
Fixed #17851 -- Added __lt__ and @total_ordering to models.Field, made sure these work correctly on other objects than Field, too.
2012-05-01Fixed #17742 -- Handled aware datetimes in DateFieldAymeric Augustin
Converted aware datetimes to the default time zone before using them in the context of a DateField.
2012-04-29Fixed #18013 -- Use the new 'as' syntax for exceptions.Claude Paroz
Thanks Clueless for the initial patch. Note that unittest has been purposely left out (external package only used by Python 2.6).
2012-04-29Prevent Oracle from changing field.null to TrueAnssi Kääriäinen
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-24Fixed #17653 -- Changed MySQL backend to raise a ValueError if zero is used ↵Anssi Kääriäinen
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-22Fixed #5893 -- Added a flag to FilePathField to allow listing folders, in ↵Alex Gaynor
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-12Fixed #18002 -- Fixed typo in attribute name in ↵Claude Paroz
ReverseSingleRelatedObjectDescriptor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17904 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-10Made the caching of related and reverse related objects consistent in ↵Aymeric Augustin
OneToOneFields. Fixed #13839. Refs #17439. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17890 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-04-10Fixed #18090 -- Applied filters when running prefetch_related backwards ↵Aymeric Augustin
through a one-to-one relation. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17888 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-03-31Removed deprecated URLField.verify_exists.Aymeric Augustin
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-29Fixed #17870 -- Documented that EmailField default max_length of 75 does not ↵Claude Paroz
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-01Fixed #17696 - Queryset prefetch_related() ignores using()Luke Plant
Thanks to simon29 for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17605 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-09Fixed #17219 -- Updated model field descriptions to be more precise. Thanks, ↵Jannis Leidel
charettes. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17476 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-02-04Fixed #17527 -- Improved exception message when adding the wrong type of ↵Jannis Leidel
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-01-24Added a missing warning forgotten in r17392.Jannis Leidel
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2012-01-24Fixed #17580 -- Made sure datetime.date instances are correctly handled when ↵Jannis Leidel
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
2011-11-25Fixed #17294 -- Supported nullable DateTimeFields when time zone support is ↵Aymeric Augustin
enabled. Thanks pressureman for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17148 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-11-19Fixed #17263 -- Added a warning when a naive datetime reaches the database ↵Aymeric Augustin
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-18Added support for time zones. Thanks Luke Plant for the review. Fixed #2626.Aymeric Augustin
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-10-14Fixed #12308 -- Added tablespace support to the PostgreSQL backend.Aymeric Augustin
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16987 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-13Fixed #16906 -- Format datetimes with str/unicode instead of strftime where ↵Aymeric Augustin
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-13Fixed a couple of `assert` syntax warnings mistakingly introduced in r16966 ↵Julien Phalip
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-13Fixed #12467 -- Made the model data validation for `DateField` and ↵Julien Phalip
`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-08More efficient IN clauses for prefetch_related queries by use of sets to ↵Luke Plant
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-07Fixed #17003 - prefetch_related should support foreign keys/one-to-oneLuke Plant
Support for `GenericForeignKey` is also included. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16939 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-06Removed ForeignRelatedObjectsDescriptor.RelatedManager.delete_manager, which ↵Luke Plant
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-05Fixed #16937 - added `QuerySet.prefetch_related` to prefetch many related ↵Luke Plant
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-09-30Fixed #14270 - related manager classes should be cachedLuke Plant
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-29Cleanups to related manager code, especially in use of closures.Luke Plant
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-29Small cleanups of 'related manager' code for consistencyLuke Plant
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-26Removed unused parameter 'join_table' in various bits of RelatedManager codeLuke Plant
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16907 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-10Altered the behavior of URLField to avoid a potential DOS vector, and to ↵Russell Keith-Magee
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-09Fixed #7596. Added Model.objects.bulk_create, and make use of it in several ↵Alex Gaynor
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-08-25Make ManyToManyField model references more robust.Malcolm Tredinnick
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-23Fix initialisation of ImageField super classes.Malcolm Tredinnick
Fixes #16548, with thanks to pyriku. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16658 bcc190cf-cafb-0310-a4f2-bffc1f526a37