Skip to content

Commit

Permalink
Merge pull request #65 from zalf-rdm/issue_#61_Feature_Set_full_user_…
Browse files Browse the repository at this point in the history
…profile_through_API

Issue #61 feature set full user profile through api
  • Loading branch information
mwallschlaeger authored May 6, 2024
2 parents e2bf610 + e94cce0 commit a12ca9d
Showing 1 changed file with 29 additions and 1 deletion.
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

0 comments on commit a12ca9d

Please sign in to comment.