summaryrefslogtreecommitdiff
path: root/django/db/models/fields
AgeCommit message (Collapse)Author
2010-03-30Fixed #13087 -- Modified m2m signals to provide greater flexibility over ↵Russell Keith-Magee
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-27Fixed #12769, #12924 -- Corrected the pickling of curried and lazy objects, ↵Russell Keith-Magee
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-27Fixed #13227 -- Modified ForeignKeys to fully honor the db_prep/prep ↵Russell Keith-Magee
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-20Fixed #12239, again: Refined the original fix to avoid the test errors ↵Karen Tracey
introduced. Thanks pmclanahan. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12821 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-20Fixed #12239: Fixed results of gte and lt queries when comparing floats to ↵Karen Tracey
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-10Forced blank=True for NullBooleanField to allow it to pass model validation ↵James Bennett
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-08Fixed #11940 - ModelForm evaluates callable default values on form class ↵Luke Plant
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-07Fixed #12913. Fields with choices now respect show_hidden_initial as a ↵Joseph Kocherhans
keyword argument to formfield. Thanks, semenov. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12696 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-06Fixed #13034: Corrected default error message for IntegerField.James Bennett
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12685 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-24Fixed #7190. Boolean fields now return bool values instead of 1 or 0. ↵Joseph Kocherhans
Thanks, Alex Gaynor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12578 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-24Fixed #12546. Objects with a __len__ that returns 0 can now be serialized. ↵Joseph Kocherhans
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-23Fixed a few more spots related to #11859. Thanks, cramm and Alex Gaynor.Joseph Kocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12537 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23Fixed #12888. Fixed a typo in some related object error messages. Thanks, ↵Joseph Kocherhans
nessita. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-22Fixed #11226 -- Corrected an validation edge case with m2m relations between ↵Russell Keith-Magee
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-02Fixed #12667. Added optgroup validation support to model fields with ↵Joseph Kocherhans
choices. Thanks ramiro. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12374 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-27Fixed #7270 -- Added the ability to follow reverse OneToOneFields in ↵Russell Keith-Magee
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-22Fixed #12540, #12541 -- Added database routers, allowing for configurable ↵Russell Keith-Magee
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-21Fixed #12582. Model validation on ForeignKeys now respects limit_choices_to. ↵Joseph Kocherhans
Thanks, Honza Král. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12271 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-14Fixed #12386 -- Corrected the column names produced for autogenerated m2m ↵Russell Keith-Magee
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-13Fixed #5390 -- Added signals for m2m operations. Thanks to the many people ↵Russell Keith-Magee
(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-12Fixed #12512. Changed ModelForm to stop performing model validation on ↵Joseph Kocherhans
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-10Changed a whole bunch of places to raise exception instances instead of ↵Adrian Holovaty
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-09Fixed #10015 -- PostgreSQL 8.3+ no longer barfs when passing an integer as a ↵Adrian Holovaty
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-09Fixed #9638 - Added %(app_label)s to the related_name format string for ↵Jannis Leidel
abstract models. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12139 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-09Fixed #12059 - Let TimeField.to_python correctly return a datetime.time ↵Jannis Leidel
object when having a datetime object. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12137 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-05Fixed a call to .using() that didn't make it into one of the ↵Joseph Kocherhans
model-validation branch merges. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-05Merged soc2009/model-validation to trunk. Thanks, Honza!Joseph Kocherhans
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22Fixed #1142 -- Added multiple database support.Russell Keith-Magee
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-17Fixed #11753 - Q objects with callables no longer explode on Python 2.4. ↵Jacob Kaplan-Moss
Thanks, Jeremy Dunck. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11901 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-17Fixed #399: Added big integer field. Thanks to Tomáš Kopeček for ↵Karen Tracey
persistently maintaining a patch for this. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11887 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-16Fixed #12385: Made built-in field type descriptions in admindocs ↵Karen Tracey
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-12Fixed #7977: Fixed admindocs to use docstrings instead of a static array to ↵Karen Tracey
locate type information. Thanks J. Clifford Dyer. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11833 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-20Fixed #12245 -- Corrected target app handling for auto-generated m2m models ↵Russell Keith-Magee
when the parent model isn't in the models module (or a subpackage thereof). Thanks to emulbreh for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11755 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-13Fixed #12209 -- Made the through attribute on a m2m relation into a property ↵Russell Keith-Magee
to ensure that the fully resolved through model is always provdided. Thanks to dgouldin for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11736 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-10Fixed #12190 -- Corrected a regression in the ability to instantiate ↵Russell Keith-Magee
ForeignKeys outside of models. Thanks to jittat for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-05Fixed #12168 -- Corrected the registration of m2m autocreated models when ↵Russell Keith-Magee
models.py is split into submodules. Thanks to Jens Diemer for the report and test case. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11724 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-03Fixed #12143 -- Corrected the naming of the 'to' column in recursive m2m ↵Russell Keith-Magee
models. Thanks to knutin@gmail.com for the report, and Alex Gaynor for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11713 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-03Fixed #11795 -- Document (and slightly simplify) the use of inlines for m2m ↵Russell Keith-Magee
relations. This is the first immediate benefit of m2m relations having an autogenerated model. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11712 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-03Fixed #10109 -- Removed the use of raw SQL in many-to-many fields by ↵Russell Keith-Magee
introducing an autogenerated through model. This is the first part of Alex Gaynor's GSoC project to add Multi-db support to Django. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11710 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-15Fixed #9023 -- Corrected a problem where cached attribute values would cause ↵Russell Keith-Magee
a delete to cascade to a related object even when the relationship had been set to None. Thanks to TheShark for the report and test case, and to juriejan and Jacob for their work on the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11009 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-15Fixed #11311 -- Reverted [10952], Refs #10785. Changeset [10952] caused ↵Russell Keith-Magee
problems with m2m relations between models that had non-integer primary keys. Thanks to Ronny for the report and test case. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11007 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08Fixed #10785 -- Corrected a case for foreign key lookup where the related ↵Russell Keith-Magee
object is a custom primary key. Thanks to Alex Gaynor for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-28Changes to `ImageFileDescriptor` and `ImageField` to fix a few cases of ↵Gary Wilson Jr
setting image dimension fields. * Moved dimension field update logic out of `ImageFileDescriptor.__set__` and into its own method on `ImageField`. * New `ImageField.update_dimension_fields` method is attached to model instance's `post_init` signal so that: * Dimension fields are set when defined before the ImageField. * Dimension fields are set when the field is assigned in the model constructor (fixes #11196), but only if the dimension fields don't already have values, so we avoid updating the dimensions every time an object is loaded from the database (fixes #11084). * Clear dimension fields when the ImageField is set to None, which also causes dimension fields to be cleared when `ImageFieldFile.delete()` is used. * Added many more tests for ImageField that test edge cases we weren't testing before, and moved the ImageField tests out of `file_storage` and into their own module within `model_fields`. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10858 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-11Fixed #10404: ImageField height_field and width_field options no longer ↵Jacob Kaplan-Moss
depend on putting the image field after the height/width fields as they did after r9766. This bug actually exposed a related handful of inconsistancies in the underlying file handling and wraping, so a few related changes are in here as well: * Dimensions are also now calculated the moment the image is assigned to the field instead of upon save. * The base `File` object now when possible delegates its closed attribute down to the os-level file it wrapps. * In-memory files' `close()` now is a no-op. Without this certain APIs that should be able to handle in-memory files were failing. * Accessing `FieldFile.closed` used to open the file. That's silly, and it doesn't any more. * Some over-eager error handling was squishing some errors that would normally be raised. One unit test was incorrectly depending on this behavior, so the test was removed. Thanks to Armin Ronacher for much of this work. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10737 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-08Fixed #7712, #9404, #10249, #10300: a light refactor and cleanup of file ↵Jacob Kaplan-Moss
storage and the `File` object. Thanks to Armin Ronacher and Alex Gaynor. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10717 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-07Fixed #10153: foreign key `gte` and `lte` lookups now work. Thanks, ↵Jacob Kaplan-Moss
joelhooks and adurdin. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10692 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-02Fixed #10349 -- Modified ManyToManyFields to allow initial form values to be ↵Russell Keith-Magee
callables. Thanks to fas for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10652 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-13Fixed #10237 -- Corrected the handling of self-referential m2m fields when ↵Russell Keith-Magee
using multi-table inheritance. Thanks to Justin Lilly for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10550 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-12Fixed #10692 -- Fixed DecimalField lookups for extreme values.Malcolm Tredinnick
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10545 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-12Fixed #10071 -- Changed some internal database data representations.Malcolm Tredinnick
We now pass numbers used in data queries as actualy numbers (integers) to the database backends, rather than string forms. This is easier for some of the less flexible backeds. Based on a patch from Leo Soto and Ramiro Morales. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10530 bcc190cf-cafb-0310-a4f2-bffc1f526a37