fix foreignkey in changset linking to created object
@@ -308,15 +308,16 @@ def changeset_detail(request, pk):
else:
field = model._meta.get_field(name)
field_title = field.verbose_name
- field_value = field.to_python(value)
if field.related_model is not None:
if issubclass(field.related_model, User):
- field_value = objects[field.related_model][field_value].username
+ field_value = objects[field.related_model][value].username
else:
- field_value = objects[field.related_model][field_value].title
+ field_value = objects[field.related_model][value].title
change_data.update({
'missing_dependency': field.name in missing_dependencies,
})
+ else:
+ field_value = field.to_python(value)
if name in unique_collisions:
change_data.update({
'unique_collision': field.name in unique_collisions,
