profiles.views module

class profiles.views.ProfileAutocompleteView(**kwargs)[source]

Bases: dal_select2.views.Select2QuerySetView

View to feed the Select2 widget.

get_queryset()[source]

Filter the queryset with GET[‘q’].

class profiles.views.ProfileCreateView(**kwargs)[source]

Bases: scipost.mixins.PermissionsMixin, django.views.generic.edit.CreateView

Formview to create a new Profile.

permission_required = 'scipost.can_create_profiles'
form_class

alias of profiles.forms.ProfileForm

template_name = 'profiles/profile_form.html'
success_url = '/profiles/'
get_context_data(*args, **kwargs)[source]

When creating a Profile, if initial data obtained from another model (Contributor, RefereeInvitation or RegistrationInvitation) is provided, this fills the context with possible already-existing Profiles.

get_initial()[source]

Provide initial data based on kwargs. The data can come from a Contributor, Invitation, …

profiles.views.profile_match(request, profile_id, from_type, pk)[source]

Links an existing Profile to one of existing Contributor, RefereeInvitation or RegistrationInvitation.

Profile relates to Contributor as OneToOne. Matching is thus only allowed if there are no duplicate objects for these elements.

For matching the Profile to a Contributor, the following preconditions are defined: - the Profile has no association to another Contributor - the Contributor has no association to another Profile If these are not met, no action is taken.

class profiles.views.ProfileUpdateView(**kwargs)[source]

Bases: scipost.mixins.PermissionsMixin, django.views.generic.edit.UpdateView

Formview to update a Profile.

permission_required = 'scipost.can_create_profiles'
model

alias of profiles.models.Profile

form_class

alias of profiles.forms.ProfileForm

template_name = 'profiles/profile_form.html'
success_url = '/profiles/'
class profiles.views.ProfileDeleteView(**kwargs)[source]

Bases: scipost.mixins.PermissionsMixin, django.views.generic.edit.DeleteView

Delete a Profile.

permission_required = 'scipost.can_create_profiles'
model

alias of profiles.models.Profile

success_url = '/profiles/'
class profiles.views.ProfileDetailView(**kwargs)[source]

Bases: scipost.mixins.PermissionsMixin, django.views.generic.detail.DetailView

permission_required = 'scipost.can_view_profiles'
model

alias of profiles.models.Profile

get_context_data(*args, **kwargs)[source]

Insert the single object into the context dict.

class profiles.views.ProfileListView(**kwargs)[source]

Bases: scipost.mixins.PermissionsMixin, scipost.mixins.PaginationMixin, django.views.generic.list.ListView

List Profile object instances.

permission_required = 'scipost.can_view_profiles'
model

alias of profiles.models.Profile

paginate_by = 25
get_queryset()[source]

Return a queryset of Profiles using optional GET data.

get_context_data(**kwargs)[source]

Get the context for this view.

class profiles.views.ProfileDuplicateListView(**kwargs)[source]

Bases: scipost.mixins.PermissionsMixin, scipost.mixins.PaginationMixin, django.views.generic.list.ListView

List Profiles with potential duplicates; allow to merge if necessary.

permission_required = 'scipost.can_create_profiles'
model

alias of profiles.models.Profile

template_name = 'profiles/profile_duplicate_list.html'
paginate_by = 16
get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

get_context_data(*args, **kwargs)[source]

Get the context for this view.

profiles.views.profile_merge(request)[source]

Merges one Profile into another.

profiles.views.add_profile_email(request, profile_id)[source]

Add an email address to a Profile.

profiles.views.email_make_primary(request, email_id)[source]

Make this email the primary one for this Profile.

profiles.views.toggle_email_status(request, email_id)[source]

Toggle valid/deprecated status of ProfileEmail.

profiles.views.delete_profile_email(request, email_id)[source]

Delete ProfileEmail.

class profiles.views.AffiliationCreateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.UserPassesTestMixin, django.views.generic.edit.CreateView

model

alias of profiles.models.Affiliation

form_class

alias of profiles.forms.AffiliationForm

template_name = 'profiles/affiliation_form.html'
test_func()[source]

Allow creating an Affiliation if user is Admin, EdAdmin or is the Contributor to which this Profile is related.

get_initial(*args, **kwargs)[source]

Return the initial data to use for forms on this view.

get_success_url()[source]

If request.user is Admin or EdAdmin, redirect to profile detail view. Otherwise if request.user is Profile owner, return to personal page.

class profiles.views.AffiliationUpdateView(**kwargs)[source]

Bases: django.contrib.auth.mixins.UserPassesTestMixin, django.views.generic.edit.UpdateView

model

alias of profiles.models.Affiliation

form_class

alias of profiles.forms.AffiliationForm

template_name = 'profiles/affiliation_form.html'
test_func()[source]

Allow updating an Affiliation if user is Admin, EdAdmin or is the Contributor to which this Profile is related.

get_success_url()[source]

If request.user is Admin or EdAdmin, redirect to profile detail view. Otherwise if request.user is Profile owner, return to personal page.

class profiles.views.AffiliationDeleteView(**kwargs)[source]

Bases: django.contrib.auth.mixins.UserPassesTestMixin, django.views.generic.edit.DeleteView

model

alias of profiles.models.Affiliation

test_func()[source]

Allow deleting an Affiliation if user is Admin, EdAdmin or is the Contributor to which this Profile is related.

get_success_url()[source]

If request.user is Admin or EdAdmin, redirect to profile detail view. Otherwise if request.user is Profile owner, return to personal page.