Commit Graph

12 Commits

Author SHA1 Message Date
Alex Gaynor 1ac4c101ae Fixed #14459 -- converted many_to_one_regress tests from doctests to unittests. We have always been at war with doctests. Patch from Gabriel Hurley.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14210 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-14 01:24:34 +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
Malcolm Tredinnick 53da1e4794 Fixed #9649 -- Better error handling in model creation.
Previously, you could explicitly assign None to a non-null ForeignKey
(or other) field when creating the model (Child(parent=None), etc). We
now throw an exception when you do that, which matches the behaviour
when you assign None to the attribute after creation.

Thanks to ales.zoulek@gmail.com and ondrej.kohout@gmail.com for some
analysis of this problem.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-06 04:51:05 +00:00
Malcolm Tredinnick 900178d795 Added a test from kcarnold to show that #7498 is fixed. Refs #7498.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-27 05:44:26 +00:00
Gary Wilson Jr 3d918f41f5 Added tests for accessing nullable ForeignKey after saving and fetching from the database (refs #8093).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8198 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-03 03:03:46 +00:00
Gary Wilson Jr 2db4b13480 Fixed #8070 -- Cache related objects passed to Model init as keyword arguments. Also:
* Model init no longer performs a database query to refetch the related objects it is passed.
 * Model init now caches unsaved related objects correctly, too. (Previously, accessing the field would raise `DoesNotExist` error for `null=False` fields.)
 * Added tests for assigning `None` to `null=True` `ForeignKey` fields (refs #6886).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8185 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-01 23:16:59 +00:00
Malcolm Tredinnick bb2182453b Fixed handling of multiple fields in a model pointing to the same related model.
Thanks to ElliotM, mk and oyvind for some excellent test cases for this. Fixed #7110, #7125.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7778 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-29 02:36:18 +00:00
Jacob Kaplan-Moss 1452d46240 Fixed #6886: Tightened up ForeignKey and OneToOne field assignment. Specifically:
* Raise a ValueError if you try to assign the wrong type of object.
  * Raise a ValueError if you try to assign None to a field not specified with null=True.
  * Cache the set value at set time instead of just at lookup time.

This is a slightly backwards-incompatible change; see BackwardsIncompatibleChanges for more details.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7574 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-05 00:39:32 +00:00
Gary Wilson Jr 212ee65be7 Fixed #2101 -- Renamed `maxlength` argument to `max_length` for oldforms `FormField`s and db model `Field`s. This is fully backwards compatible at the moment since the legacy `maxlength` argument is still supported. Using `maxlength` will, however, issue a `PendingDeprecationWarning` when used.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-05 05:14:46 +00:00
Malcolm Tredinnick 43809de79d Fixed #1839, #2415, #2536 -- Fixed a generated name clash that was common in
self-referential and circular relations. A lot of community debugging went into
this fix, so thanks to bmurdock@gmail.com, Marek Kubica, ramiro, Michael
Radziej (the last two giving test cases showing the problem) and James Bennett
(who did the hard work to actually diagnose the true problem and fix it).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4676 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-03-08 03:21:35 +00:00
Russell Keith-Magee 97b9ad73b4 Refs #2333 - Modified runtests script to use new testing framework. Migrated existing tests to use Django testing framework. All the 'othertests' have been migrated into 'regressiontests', and converted into doctests/unittests, as appropriate.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-08-27 13:59:47 +00:00
Malcolm Tredinnick a778c9de47 Fixed #1578 -- fixed a corner-case where we still wanting core=True attributes
on a model that was not being edited inline.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3275 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-07-04 10:48:07 +00:00