Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #61 feature set full user profile through api #65

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion geonode/base/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,37 @@ def get_attribute(self, instance):
return False



class UserSerializer(BaseDynamicModelSerializer):
class Meta:
ref_name = "UserProfile"
model = get_user_model()
name = "user"
view_name = "users-list"
fields = ("pk", "username", "first_name", "last_name", "avatar", "perms", "is_superuser", "is_staff", "orcid_identifier")
fields = ("pk",
"username",
"first_name",
"last_name",
"avatar",
"perms",
"is_superuser",
"is_staff",
"email",
"organization",
"profile",
"position",
"voice",
"fax",
"delivery",
"city",
"area",
"zipcode",
"keywords",
"country",
"language",
"timezone",
"orcid_identifier"
)

@classmethod
def setup_eager_loading(cls, queryset):
Expand All @@ -442,6 +466,10 @@ def to_representation(self, instance):
return data

avatar = AvatarUrlField(240, read_only=True)
keywords = ComplexDynamicRelationField(
SimpleHierarchicalKeywordSerializer, embed=False, many=True
)



class ContactRoleField(DynamicComputedField):
Expand Down
Loading