Ticket #16208: python.py.patch

File python.py.patch, 931 bytes (added by jeff.k@…, 13 years ago)

fixes deserialization bug

Line 
1113,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
7119c114,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
Back to Top