grantmcconnaughey / django-field-history

A Django app to track changes to model fields.
BSD 3-Clause "New" or "Revised" License
314 stars 33 forks source link

createinitialfieldhistory doesn't work for objects without id field #20

Closed vigilyn closed 7 years ago

vigilyn commented 7 years ago

I use a uuid for a primary key on my objects, and as such call it uuid. When I go to create the initial field history, I get this error:

File "lib/python2.7/site-packages/field_history/management/commands/createinitialfieldhistory.py", line 35, in handle object_id=obj.id, AttributeError: 'Order' object has no attribute 'id'

I fixed this by changing line 35 in createinitialfieldhistory.py to object_id=obj.pk

grantmcconnaughey commented 7 years ago

Sorry about that! I almost always use pk instead of id...not sure why I didn't in this case. I'll get that patched up.

grantmcconnaughey commented 7 years ago

Fixed in 49bb5bfb831bdffd090fde9df3a0a4cdd1281d95. Thanks for reporting this!