Commit Graph

261 Commits

Author SHA1 Message Date
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
Karen Tracey 0986a4d2e1 Fixed #7977: Fixed admindocs to use docstrings instead of a static array to locate type information.
Thanks J. Clifford Dyer.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11833 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-12 20:25:41 +00:00
Russell Keith-Magee 660f9086f1 Fixed #12245 -- Corrected target app handling for auto-generated m2m models 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-20 00:59:38 +00:00
Russell Keith-Magee dd045aaab5 Fixed #12209 -- Made the through attribute on a m2m relation into a property 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-13 12:34:41 +00:00
Russell Keith-Magee 70f9a4f6ce Fixed #12190 -- Corrected a regression in the ability to instantiate 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-10 15:21:12 +00:00
Russell Keith-Magee 7b63d3d3b4 Fixed #12168 -- Corrected the registration of m2m autocreated models when 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-05 11:57:28 +00:00
Russell Keith-Magee f9ead3fe42 Fixed #12143 -- Corrected the naming of the 'to' column in recursive m2m 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-03 23:34:58 +00:00
Russell Keith-Magee dab3e97c1a Fixed #11795 -- Document (and slightly simplify) the use of inlines for m2m 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-03 15:02:16 +00:00
Russell Keith-Magee 585b7acaa3 Fixed #10109 -- Removed the use of raw SQL in many-to-many fields by 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-11-03 14:02:49 +00:00
Russell Keith-Magee 191203b48d Fixed #9023 -- Corrected a problem where cached attribute values would cause 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-15 14:30:51 +00:00
Russell Keith-Magee b38cf5db5c Fixed #11311 -- Reverted [10952], Refs #10785. Changeset [10952] caused 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-15 11:47:01 +00:00
Russell Keith-Magee 6cd37e0a1f Fixed #10785 -- Corrected a case for foreign key lookup where the related 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-06-08 04:50:24 +00:00
Gary Wilson Jr d89ba464dd Changes to `ImageFileDescriptor` and `ImageField` to fix a few cases of 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-28 05:46:09 +00:00
Jacob Kaplan-Moss 2b0903b2c4 Fixed #10404: ImageField height_field and width_field options no longer 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-11 09:57:19 +00:00
Jacob Kaplan-Moss 68a890e79f Fixed #7712, #9404, #10249, #10300: a light refactor and cleanup of file 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-08 15:08:09 +00:00
Jacob Kaplan-Moss fb9ac5729d Fixed #10153: foreign key `gte` and `lte` lookups now work. Thanks, joelhooks and adurdin.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10692 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-07 16:12:08 +00:00
Russell Keith-Magee fbf5eaac94 Fixed #10349 -- Modified ManyToManyFields to allow initial form values to be 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-05-02 07:03:33 +00:00
Russell Keith-Magee 0fec0a5d70 Fixed #10237 -- Corrected the handling of self-referential m2m fields when 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-13 02:59:40 +00:00