User
User views for smarter api.
- smarter.apps.account.api.v1.views.user.USER_CREATE_FIELDS = ('username', 'password', 'email', 'first_name', 'last_name')
The fields of a new user that the request body may set.
('username', 'password', 'email', 'first_name', 'last_name')
- smarter.apps.account.api.v1.views.user.USER_UPDATE_FIELDS = ('username', 'email', 'first_name', 'last_name', 'is_active')
The fields of a user that the request body may update.
('username', 'email', 'first_name', 'last_name', 'is_active')
- class smarter.apps.account.api.v1.views.user.UserListView(*args, **kwargs)[source]
Bases:
AccountListViewBaseUser list view for smarter api.
- get_list(request)[source]
Get a list of all users the requesting user has access to, as
AccountApiUserDetailmodels.
- get_queryset()[source]
Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
- serializer_class
alias of
UserSerializer
- class smarter.apps.account.api.v1.views.user.UserView(*args, **kwargs)[source]
Bases:
AccountViewBaseUser view for smarter api.
- smarter.apps.account.api.v1.views.user.create_user(request)[source]
Create an account from a json representation in the body of the request.
- smarter.apps.account.api.v1.views.user.delete_user(request, user_id=None)[source]
Delete a user by id.
- smarter.apps.account.api.v1.views.user.eval_permissions(request, user_to_update, user_to_update_profile=None)[source]
- smarter.apps.account.api.v1.views.user.get_user(request, user_id=None)[source]
Get a user’s json representation, an
AccountApiUserDetail, by id.
- smarter.apps.account.api.v1.views.user.get_user_for_operation(request, user_id)[source]
- Return type:
- smarter.apps.account.api.v1.views.user.update_user(request, user_id)[source]
Update an account from a json representation in the body of the request.
- smarter.apps.account.api.v1.views.user.user_response(user)[source]
The response of a user: its
AccountApiUserDetail.- Parameters:
user (django.contrib.auth.models.User) – The user.
- Returns:
The response.
- Return type:
Response