mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Renamed Field.rel attribute to remote_field
Field.rel is now deprecated. Rel objects have now also remote_field attribute. This means that self == self.remote_field.remote_field. In addition, made the Rel objects a bit more like Field objects. Still, marked ManyToManyFields as null=True.
This commit is contained in:
committed by
Tim Graham
parent
f9c70bb3a1
commit
8f30556329
@@ -26,8 +26,8 @@ def get_normalized_value(value, lhs):
|
||||
# Account for one-to-one relations when sent a different model
|
||||
sources = lhs.output_field.get_path_info()[-1].target_fields
|
||||
for source in sources:
|
||||
while not isinstance(value, source.model) and source.rel:
|
||||
source = source.rel.to._meta.get_field(source.rel.field_name)
|
||||
while not isinstance(value, source.model) and source.remote_field:
|
||||
source = source.remote_field.model._meta.get_field(source.remote_field.field_name)
|
||||
value_list.append(getattr(value, source.attname))
|
||||
return tuple(value_list)
|
||||
if not isinstance(value, tuple):
|
||||
|
||||
Reference in New Issue
Block a user