Closed mariodev closed 8 years ago
Hey, thanks for the PR! I like this idea. I think I see a bug, however. This part:
if not FieldHistory.objects.filter(object_id=obj.id, field_name=field).exists():
# etc.
Should be this:
content_type = ContentType.objects.get_for_model(obj)
if not FieldHistory.objects.filter(object_id=obj.id, content_type=content_type, field_name=field).exists():
# etc.
That's because object
is a GenericForeignKey
, so you have to query for object id and content type.
Write a test that fixes that bug, fix the bug, and I'll get it merged soon. Thanks again!
@grantmcconnaughey Added necessary fixes. Thanks for your help!
Awesome stuff, @mariodev. Thanks a lot. 👍
Resolves #8