1 | 113,117d112
|
---|
2 | < value = getattr(obj, field.rel.field_name)
|
---|
3 | < # If this is a natural foreign key to an object that
|
---|
4 | < # has a FK/O2O as the foreign key, use the FK value
|
---|
5 | < if field.rel.to._meta.pk.rel:
|
---|
6 | < value = value.pk
|
---|
7 | 119c114,119
|
---|
8 | < value = field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value)
|
---|
9 | ---
|
---|
10 | > obj = field.rel.to._default_manager.db_manager(db).get_by_natural_key(field_value)
|
---|
11 | > value = getattr(obj, field.rel.field_name)
|
---|
12 | > # If this is a natural foreign key to an object that
|
---|
13 | > # has a FK/O2O as the foreign key, use the FK value
|
---|
14 | > if field.rel.to._meta.pk.rel:
|
---|
15 | > value = value.pk
|
---|