from core.models.profile import UserProfile
from rest_framework import serializers
from .identity_related_field import IdentityRelatedField


class ProfileSerializer(serializers.ModelSerializer):
    """
    """
    #TODO:Need to validate provider/identity membership on id change
    username = serializers.CharField(read_only=True, source='user.username')
    email = serializers.CharField(read_only=True, source='user.email')
    groups = serializers.CharField(read_only=True, source='user.groups.all')
    is_staff = serializers.BooleanField(source='user.is_staff')
    is_superuser = serializers.BooleanField(source='user.is_superuser')
    selected_identity = IdentityRelatedField(source='user.select_identity')

    class Meta:
        model = UserProfile
        exclude = ('id',)
@@ -37,16 +37,49 @@
 Profile%0A
+from core.models import Identity%0A
 from res
@@ -742,16 +742,49 @@
 dentity'
+, queryset=Identity.objects.all()
 )%0A%0A    c
@@ -825,30 +825,4 @@
 file
-%0A        exclude = ('id',)

upgrade ProfileSerializer to DRF3