Closed rabialam closed 12 years ago
Currently, the user profile resource is not implemented correctly -- it uses a subset of fields off of User query set when it should really use the UserProfile query set. However, right now, a corresponding UserProfile object is not created when the User object is created through interaction with the registration endpoint.
User profile resource now implemented to use UserProfile query set. Email signup form modified to create UserProfile after creating new user. API tests updated to reflect changes.
To use this new resource:
userprofile
endpoint of API.first_name
and last_name
fieldExample call (from my unit test):
(note that here, self.uri = '/api/v1/userprofile/'
)
auth_header = 'Basic %s' % base64.b64encode('%s:%s' %
(user_profile.user.email, self.password))
resp = self.client.get(self.uri, data=self.auth_params,
HTTP_AUTHORIZATION=auth_header)
Then, we get this in resp.content
:
{'meta': {'limit': 20,
'next': None,
'offset': 0,
'previous': None,
'total_count': 1},
'objects': [{'first_name': '1',
'last_name': '1',
'resource_uri': '/api/v1/userprofile/1/'}]}
Currently, there is no way to submit first and last names as fields for user creation, nor any way to retrieve these profile fields for a given user.