Expose a gravatar hash for account via the Rest API

This commit is contained in:
Krzysztof Klimonda
2013-02-22 01:28:56 +01:00
parent 254b628200
commit 270cfb7ee7
2 changed files with 16 additions and 1 deletions

View File

@@ -2,12 +2,17 @@ from tastypie.resources import ModelResource
from tastypie import fields
from tastypie.authorization import DjangoAuthorization
from django.contrib.auth.models import User
from pinry.core.models import User
from pinry.pins.models import Pin
class UserResource(ModelResource):
gravatar = fields.CharField()
def dehydrate_gravatar(self, bundle):
return bundle.obj.gravatar
class Meta:
queryset = User.objects.all()
resource_name = 'user'