14.3.110. crate_anon.crateweb.core.admin
crate_anon/crateweb/core/admin.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/>.
The Django admin site, with parts for researchers (staff), parts for RDBMs (superusers) and parts for developers (superusers with the developer flag set).
- class crate_anon.crateweb.core.admin.ArchiveAttachmentAuditMgrAdmin(model, admin_site)[source]
Read-only admin view of
crate_anon.crateweb.research.models.ArchiveAttachmentAudit
objects.- model
alias of
ArchiveAttachmentAudit
- class crate_anon.crateweb.core.admin.ArchiveTemplateAuditMgrAdmin(model, admin_site)[source]
Read-only admin view of
crate_anon.crateweb.research.models.ArchiveTemplateAudit
objects.- model
alias of
ArchiveTemplateAudit
- class crate_anon.crateweb.core.admin.CharityPaymentRecordMgrAdmin(model, admin_site)[source]
RDBM admin view on a
crate_anon.crateweb.consent.models.CharityPaymentRecord
.
- class crate_anon.crateweb.core.admin.ClinicianRespondedListFilter(request, params, model, model_admin)[source]
Filter for
crate_anon.crateweb.consent.models.ContactRequest
based on whether the clinician has responded.
- class crate_anon.crateweb.core.admin.ClinicianResponseDevAdmin(model, admin_site)[source]
Developer admin view on
crate_anon.crateweb.consent.models.ClinicianResponse
.
- class crate_anon.crateweb.core.admin.ConsentModeAdminForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]
Admin form to edit a
crate_anon.crateweb.consent.models.ConsentMode
.- clean() Dict[str, Any] [source]
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- class crate_anon.crateweb.core.admin.ConsentModeDevAdmin(model, admin_site)[source]
Developer admin view on a
crate_anon.crateweb.consent.models.ConsentMode
.
- class crate_anon.crateweb.core.admin.ConsentModeInline(parent_model, admin_site)[source]
Use this to represent
crate_anon.crateweb.consent.models.ConsentMode
inline.- model
alias of
ConsentMode
- class crate_anon.crateweb.core.admin.ConsentModeMgrAdmin(model, admin_site)[source]
RDBM admin view on a
crate_anon.crateweb.consent.models.ConsentMode
.- form
alias of
ConsentModeAdminForm
- get_queryset(request: HttpRequest) QuerySet [source]
Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
- save_model(request: HttpRequest, obj: ConsentMode, form: ModelForm, change: bool) None [source]
Given a model instance save it to the database.
- class crate_anon.crateweb.core.admin.ContactRequestDevAdmin(model, admin_site)[source]
Developer admin view on
crate_anon.crateweb.consent.models.ContactRequest
.
- class crate_anon.crateweb.core.admin.ContactRequestMgrAdmin(model, admin_site)[source]
RDBM admin view on
crate_anon.crateweb.consent.models.ContactRequest
.
- class crate_anon.crateweb.core.admin.ContactRequestResAdmin(model, admin_site)[source]
Researcher admin view on
crate_anon.crateweb.consent.models.ContactRequest
.- get_queryset(request: HttpRequest) QuerySet [source]
Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
- has_change_permission(request: HttpRequest, obj: ContactRequest | None = None) bool [source]
Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.
Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the obj model instance. If obj is None, this should return True if the given request has permission to change any object of the given type.
- has_module_permission(request: HttpRequest) bool [source]
Return True if the given request has any permission in the given app label.
Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to view the module on the admin index page and access the module’s index page. Overriding it does not restrict access to the add, change or delete views. Use ModelAdmin.has_(add|change|delete)_permission for that.
- class crate_anon.crateweb.core.admin.DummyPatientSourceInfoDevAdmin(model, admin_site)[source]
Developer admin view on
crate_anon.crateweb.consent.models.DummyPatientSourceInfo
.
- class crate_anon.crateweb.core.admin.EmailDevAdmin(model, admin_site)[source]
Developer admin view on
crate_anon.crateweb.consent.models.Email
.
- class crate_anon.crateweb.core.admin.EmailMgrAdmin(model, admin_site)[source]
RDBM admin view on
crate_anon.crateweb.consent.models.Email
.Restrict to e-mails/information visible to the RDBM. Also, since we’re not inhering from
AllStaffReadOnlyModelAdmin
, give admin read permissions to all staff.
- class crate_anon.crateweb.core.admin.EmailResAdmin(model, admin_site)[source]
Researcher admin view on
crate_anon.crateweb.consent.models.Email
.Restrict to e-mails visible to a researcher. Also, since we’re not inhering from
AllStaffReadOnlyModelAdmin
, give admin read permissions to all staff.- actions = None
- get_queryset(request: HttpRequest) QuerySet [source]
Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
- has_change_permission(request: HttpRequest, obj: Email | None = None) bool [source]
Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.
Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the obj model instance. If obj is None, this should return True if the given request has permission to change any object of the given type.
- has_module_permission(request: HttpRequest) bool [source]
Return True if the given request has any permission in the given app label.
Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to view the module on the admin index page and access the module’s index page. Overriding it does not restrict access to the add, change or delete views. Use ModelAdmin.has_(add|change|delete)_permission for that.
- class crate_anon.crateweb.core.admin.EmailSentListFilter(request, params, model, model_admin)[source]
Filter for
crate_anon.crateweb.consent.models.Email
based on whether they’re sent or not.
- class crate_anon.crateweb.core.admin.ExtendedUserMgrAdmin(model, admin_site)[source]
RDBM admin view on the Django user class with its associated
crate_anon.crateweb.userprofile.models.UserProfile
.
- class crate_anon.crateweb.core.admin.LeafletMgrAdmin(model, admin_site)[source]
RDBM admin view on
crate_anon.crateweb.consent.models.Leaflet
.
- class crate_anon.crateweb.core.admin.LeafletResAdmin(model, admin_site)[source]
Researcher admin view on
crate_anon.crateweb.consent.models.Leaflet
.
- class crate_anon.crateweb.core.admin.LetterDevAdmin(model, admin_site)[source]
Developer admin view on
crate_anon.crateweb.consent.models.Letter
.
- class crate_anon.crateweb.core.admin.LetterMgrAdmin(model, admin_site)[source]
RDBM admin view on
crate_anon.crateweb.consent.models.Letter
.
- class crate_anon.crateweb.core.admin.LetterResAdmin(model, admin_site)[source]
Researcher admin view on
crate_anon.crateweb.consent.models.Letter
.Restrict to letters visible to a researcher.
- get_queryset(request: HttpRequest) QuerySet [source]
Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
- has_change_permission(request: HttpRequest, obj: Letter | None = None) bool [source]
Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.
Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the obj model instance. If obj is None, this should return True if the given request has permission to change any object of the given type.
- has_module_permission(request: HttpRequest) bool [source]
Return True if the given request has any permission in the given app label.
Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to view the module on the admin index page and access the module’s index page. Overriding it does not restrict access to the add, change or delete views. Use ModelAdmin.has_(add|change|delete)_permission for that.
- class crate_anon.crateweb.core.admin.LetterSendingStatusFilter(request, params, model, model_admin)[source]
Filter for
crate_anon.crateweb.consent.models.Letter
based on whether they’re sent or not.
- class crate_anon.crateweb.core.admin.PatientExplorerAuditMgrAdmin(model, admin_site)[source]
Read-only admin view of
crate_anon.crateweb.research.models.PatientExplorerAudit
objects.- model
alias of
PatientExplorerAudit
- class crate_anon.crateweb.core.admin.PatientLookupDevAdmin(model, admin_site)[source]
Developer admin view on
crate_anon.crateweb.consent.models.PatientLookup
.
- class crate_anon.crateweb.core.admin.PatientResponseAdminForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]
Admin form to edit a
crate_anon.crateweb.consent.models.PatientResponse
.- clean() Dict[str, Any] [source]
Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
- property media
Return all media required to render the widgets on this form.
- class crate_anon.crateweb.core.admin.PatientResponseDevAdmin(model, admin_site)[source]
Developer admin view on a
crate_anon.crateweb.consent.models.PatientResponse
.
- class crate_anon.crateweb.core.admin.PatientResponseMgrAdmin(model, admin_site)[source]
RDBM admin view on a
crate_anon.crateweb.consent.models.PatientResponse
.- form
alias of
PatientResponseAdminForm
- get_queryset(request: HttpRequest) QuerySet [source]
Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
- has_change_permission(request: HttpRequest, obj: PatientResponse | None = None) bool [source]
Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.
Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to change the obj model instance. If obj is None, this should return True if the given request has permission to change any object of the given type.
- save_model(request: HttpRequest, obj: PatientResponse, form: ModelForm, change: bool) None [source]
Given a model instance save it to the database.
- class crate_anon.crateweb.core.admin.QueryMgrAdmin(model, admin_site)[source]
Read-only admin view to inspect SQL queries used by researchers (that is, to perform a query audit).
- model
alias of
QueryAudit
- class crate_anon.crateweb.core.admin.ResearcherAdminSite(name='admin')[source]
Researcher admin site.
- class crate_anon.crateweb.core.admin.StudyInline(parent_model, admin_site)[source]
Use this to represent
crate_anon.crateweb.consent.models.Study
inline.
- class crate_anon.crateweb.core.admin.StudyMgrAdmin(model, admin_site)[source]
RDBM admin view on
crate_anon.crateweb.consent.models.Study
.
- class crate_anon.crateweb.core.admin.StudyResAdmin(model, admin_site)[source]
Researcher admin view on RDBM admin view on
crate_anon.crateweb.consent.models.Study
.
- class crate_anon.crateweb.core.admin.TeamRepMgrAdmin(model, admin_site)[source]
RDBM admin view on a
crate_anon.crateweb.consent.models.TeamRep
.- form
alias of
TeamRepAdminForm
- class crate_anon.crateweb.core.admin.UserProfileInline(parent_model, admin_site)[source]
Use this to represent
crate_anon.crateweb.userprofile.models.UserProfile
inline.- model
alias of
UserProfile