toastdriven/django-tastypie — Issue #276: get_resource_uri assumes an object has an `id` field
Author: ipmb
Created: 2011-11-01 15:18:44+00:00
State: open

When trying to get the resource_uri from an instance of a Django model that does not have an `id` field, [this line](https://github.com/toastdriven/django-tastypie/blob/90d2700bd961d4482a26d232e6ece54ec363941f/tastypie/resources.py#L1658) raises an exception:

kwargs['pk'] = bundle_or_obj.id

changing it to the following fixes the issue for me:

kwargs['pk'] = bundle_or_obj.pk