diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2013-07-26 13:02:32 +0300 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2013-07-26 13:13:27 +0300 |
| commit | 7cca8d56d28e321ffc395c92f82d97adaa0dcf94 (patch) | |
| tree | d1c4b83c1033642715ae11ed32691571e7376a87 /django | |
| parent | 31fadc120213284da76801cc7bc56e9f32d7281b (diff) | |
Fixed related model lookup regression
It has been possible to use models of wrong type in related field
lookups. For example pigs__in=[a_duck] has worked. Changes to
ForeignObject broke that.
It might be a good idea to restrict the model types usable in lookups.
This should be done intentionally, not accidentally and without any
consideration for deprecation path.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/fields/related.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 11a20983eb..b84693eba4 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -1060,7 +1060,7 @@ class ForeignObject(RelatedField): value_list = [] for source in sources: # Account for one-to-one relations when sent a different model - while not isinstance(value, source.model): + while not isinstance(value, source.model) and source.rel: source = source.rel.to._meta.get_field(source.rel.field_name) value_list.append(getattr(value, source.attname)) return tuple(value_list) |
