14.3.274. crate_anon.crateweb.userprofile.models
crate_anon/crateweb/userprofile/models.py
Copyright (C) 2015, University of Cambridge, Department of Psychiatry. Created by Rudolf Cardinal (rnc1001@cam.ac.uk).
This file is part of CRATE.
CRATE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
CRATE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with CRATE. If not, see <https://www.gnu.org/licenses/>.
Extended user profile for Django, with all our user configuration details.
- class crate_anon.crateweb.userprofile.models.UserProfile(*args, **kwargs)[source]
User profile information.
This is used for:
stuff the user might edit, e.g. per_page
a representation of the user as a researcher (or maybe clinician)
- exception DoesNotExist
- exception MultipleObjectsReturned
- crate_anon.crateweb.userprofile.models.get_patients_per_page(request: HttpRequest) int | None [source]
Returns the number of patients per page (a pagination preference, for the Patient Explorer view) of the current user.
- Parameters:
request – the
django.http.request.HttpRequest
- Returns:
the number of patients per page, or
None
if the user was not authenticated
- crate_anon.crateweb.userprofile.models.get_per_page(request: HttpRequest) int | None [source]
Returns the number of items per page (a pagination preference) of the current user.
- Parameters:
request – the
django.http.request.HttpRequest
- Returns:
the number of items per page, or
None
if the user was not authenticated
- crate_anon.crateweb.userprofile.models.user_saved_so_create_profile(sender: Type[auth.User], instance: auth.User, created: bool, **kwargs: Any) None [source]
Django signal receiver.
Called when a Django User object has been saved. Attaches
- Parameters:
sender – the model class (User)
instance – will be the User object
created – was a new record created?
**kwargs – other arguments we don’t care about
See https://docs.djangoproject.com/en/2.1/ref/signals/#post-save.