jedie / django-reversion-compare

Add compare view to django-reversion for comparing two versions of a reversion model.
https://pypi.org/project/django-reversion-compare/
315 stars 105 forks source link

Bug if use custom generic fields #12

Open pahaz opened 11 years ago

pahaz commented 11 years ago
Traceback:
File " venv\lib\site-packages\django\core\handlers\base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File " venv\lib\site-packages\django\utils\decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File " venv\lib\site-packages\django\views\decorators\cache.py" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File " venv\lib\site-packages\django\contrib\admin\sites.py" in inner
  202.             return view(request, *args, **kwargs)
File " venv\lib\site-packages\reversion_compare\admin.py" in compare_view
  633.         compare_data, has_unfollowed_fields = self.compare(obj, request, version1, version2)
File " venv\lib\site-packages\reversion_compare\admin.py" in compare
  582.             obj_compare = CompareObjects(field, field_name, obj, version1, version2, self.revision_manager)
File " venv\lib\site-packages\reversion_compare\admin.py" in __init__
  223.         self.compare_obj1 = CompareObject(field, field_name, obj, version1, self.has_int_pk, self.adapter)
File " venv\lib\site-packages\reversion_compare\admin.py" in __init__
  48.         self.value = version.field_dict[field_name]

Exception Type: KeyError at /admin/blog/blogpost/2/history/compare/
Exception Value: 'comments'

Bug is i use custom fields: comments = CommentsField(verbosename=("Comments"))

https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/blog/models.py#L21

jedie commented 11 years ago

Hm! This related to: https://github.com/jedie/django-reversion-compare/issues/10 isn't it?

Can you try the patch from there?

pahaz commented 11 years ago

likely. Simple solutions I have found. Need for more detailed understanding of the architecture. The matter related objects. Solution can serve as a complete recovery forms. And to get the values ​​of them. The key to solving this problem may be is the code: https://github.com/etianen/django-reversion/blob/master/src/reversion/admin.py#L311-L342

jedie commented 9 years ago

Any news on this issues? Did this happen in the current release or can this been closed?!?