Return a public snipt URL for favorited resources.

master
Nick Sergeant 2012-11-23 08:53:42 -05:00
parent 4e3961bb04
commit 2dc50d3d95
1 changed files with 5 additions and 0 deletions

View File

@ -305,6 +305,11 @@ class PrivateFavoriteResource(ModelResource):
max_limit = 200
cache = SimpleCache()
def dehydrate(self, bundle):
bundle.data['snipt'] = '/api/public/snipt/{}/'.format(
bundle.obj.snipt.pk)
return bundle
def obj_create(self, bundle, request=None, **kwargs):
bundle.data['user'] = request.user
bundle.data['snipt'] = Snipt.objects.get(pk=bundle.data['snipt'])