Created
March 16, 2012 17:37
-
-
Save toastdriven/2051328 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.models import User | |
from tastypie import fields | |
from tastypie.resources import ModelResource | |
from profiles.models import Profile | |
class UserResource(ModelResource): | |
# Assumes a OneToOneField on the ``Profile``. | |
bio = fields.CharField(attribute='profile__bio', blank=True, default='', readonly=True) | |
website = fields.CharField(attribute='profile__website', blank=True, default='', readonly=True) | |
twitter = fields.CharField(attribute='profile__twitter', blank=True, default='', readonly=True) | |
class Meta: | |
queryset = User.objects.all() | |
excludes = ['email', 'password', 'is_staff', 'is_superuser'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment