Skip to content

Instantly share code, notes, and snippets.

@colinsullivan
colinsullivan / django-tastypie_user-profile-field.py
Created April 12, 2011 17:13
This is a django-tastypie resource field that incorporates the Django user profile into a model resource for a `User` transparently.
###
# This field is used on the user model to transparently add stuff from the
# user profile object into the user resource.
#
# Copyright (c) 2012 Colin Sullivan <colinsul [at] gmail.com>
# Licensed under the MIT License.
###
class UserProfileManyToManyField(fields.ManyToManyField):
###
# We will override the dehydrate method so when we're trying to dehydrate