scipost.forms module

class scipost.forms.RequestFormMixin(*args, **kwargs)[source]

Bases: object

This mixin lets the Form accept request as an argument.

class scipost.forms.HttpRefererFormMixin(*args, **kwargs)[source]

Bases: scipost.forms.RequestFormMixin

This mixin adds a HiddenInput to the form which tracks the previous url, which can be used to redirect to.

class scipost.forms.RegistrationForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.forms.Form

Use this form to process the registration of new accounts. Due to the construction of a separate Contributor from the User, it is difficult to create a ‘combined ModelForm’. All fields are thus separately handled here.

clean()[source]

Check that: * either an organization or an address are provided * that any existing associated profile does not already have a Contributor

clean_password()[source]
clean_password_verif()[source]
clean_username()[source]
clean_email()[source]
create_and_save_contributor()[source]
base_fields = {'acad_field': <django.forms.models.ModelChoiceField object>, 'address': <django.forms.fields.CharField object>, 'captcha': <scipost.fields.ReCaptchaField object>, 'current_affiliation': <django.forms.models.ModelChoiceField object>, 'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'invitation_key': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'orcid_id': <django.forms.fields.CharField object>, 'password': <django.forms.fields.CharField object>, 'password_verif': <django.forms.fields.CharField object>, 'specialties': <django.forms.models.ModelMultipleChoiceField object>, 'subscribe': <django.forms.fields.BooleanField object>, 'title': <django.forms.fields.ChoiceField object>, 'username': <django.forms.fields.CharField object>, 'webpage': <django.forms.fields.URLField object>}
declared_fields = {'acad_field': <django.forms.models.ModelChoiceField object>, 'address': <django.forms.fields.CharField object>, 'captcha': <scipost.fields.ReCaptchaField object>, 'current_affiliation': <django.forms.models.ModelChoiceField object>, 'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'invitation_key': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'orcid_id': <django.forms.fields.CharField object>, 'password': <django.forms.fields.CharField object>, 'password_verif': <django.forms.fields.CharField object>, 'specialties': <django.forms.models.ModelMultipleChoiceField object>, 'subscribe': <django.forms.fields.BooleanField object>, 'title': <django.forms.fields.ChoiceField object>, 'username': <django.forms.fields.CharField object>, 'webpage': <django.forms.fields.URLField object>}
property media
class scipost.forms.ModifyPersonalMessageForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.forms.Form

base_fields = {'personal_message': <django.forms.fields.CharField object>}
declared_fields = {'personal_message': <django.forms.fields.CharField object>}
property media
class scipost.forms.UpdateUserDataForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

model

alias of django.contrib.auth.models.User

fields = ['email', 'first_name', 'last_name']
clean_last_name()[source]

Make sure the last_name cannot be saved via this form.

base_fields = {'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>}
declared_fields = {}
property media
class scipost.forms.UpdatePersonalDataForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

model

alias of scipost.models.Contributor

fields = ['title', 'acad_field', 'specialties', 'orcid_id', 'address', 'webpage', 'accepts_SciPost_emails']
save()[source]

Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.

sync_lists()[source]

Pseudo U/S; do not remove

propagate_orcid()[source]

This method is called if a Contributor updates their personal data, and changes the orcid_id. It marks all Publications, Reports and Comments authored by this Contributor with a deposit_requires_update == True.

base_fields = {'acad_field': <django.forms.models.ModelChoiceField object>, 'accepts_SciPost_emails': <django.forms.fields.BooleanField object>, 'address': <django.forms.fields.CharField object>, 'orcid_id': <django.forms.fields.CharField object>, 'specialties': <django.forms.models.ModelMultipleChoiceField object>, 'title': <django.forms.fields.ChoiceField object>, 'webpage': <django.forms.fields.URLField object>}
declared_fields = {'acad_field': <django.forms.models.ModelChoiceField object>, 'accepts_SciPost_emails': <django.forms.fields.BooleanField object>, 'orcid_id': <django.forms.fields.CharField object>, 'specialties': <django.forms.models.ModelMultipleChoiceField object>, 'title': <django.forms.fields.ChoiceField object>, 'webpage': <django.forms.fields.URLField object>}
property media
class scipost.forms.VetRegistrationForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.forms.Form

promote_to_registered_contributor()[source]
base_fields = {'decision': <django.forms.fields.ChoiceField object>, 'email_response_field': <django.forms.fields.CharField object>, 'refusal_reason': <django.forms.fields.ChoiceField object>}
declared_fields = {'decision': <django.forms.fields.ChoiceField object>, 'email_response_field': <django.forms.fields.CharField object>, 'refusal_reason': <django.forms.fields.ChoiceField object>}
property media
class scipost.forms.SciPostAuthenticationForm(request=None, *args, **kwargs)[source]

Bases: django.contrib.auth.forms.AuthenticationForm

Authentication form for all types of users at SciPost.

Inherits from django.contrib.auth.forms:AuthenticationForm.

Extra fields:

  • next: url for the next page, obtainable via POST

Overriden methods:

  • clean: allow either username, or email as substitute for username

  • confirm_login_allowed: disallow inactive or unvetted accounts.

clean()[source]

Allow either username, or email as substitute for username.

confirm_login_allowed(user)[source]

Controls whether the given User may log in. This is a policy setting, independent of end-user authentication. This default behavior is to allow login by active users, and reject login by inactive users.

If the given user cannot log in, this method should raise a ValidationError.

If the given user may log in, this method should return None.

base_fields = {'code': <django.forms.fields.CharField object>, 'next': <django.forms.fields.CharField object>, 'password': <django.forms.fields.CharField object>, 'username': <django.contrib.auth.forms.UsernameField object>}
declared_fields = {'code': <django.forms.fields.CharField object>, 'next': <django.forms.fields.CharField object>, 'password': <django.forms.fields.CharField object>, 'username': <django.contrib.auth.forms.UsernameField object>}
property media
class scipost.forms.UserAuthInfoForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.forms.Form

get_data()[source]
base_fields = {'username': <django.forms.fields.CharField object>}
declared_fields = {'username': <django.forms.fields.CharField object>}
property media
class scipost.forms.TOTPDeviceForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

model

alias of scipost.models.TOTPDevice

fields = ['name', 'token']
widgets = {'token': <django.forms.widgets.HiddenInput object>}
labels = {'name': 'Device name'}
property secret_key
get_QR_data()[source]
clean()[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__’.

save()[source]

Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.

base_fields = {'code': <django.forms.fields.CharField object>, 'name': <django.forms.fields.CharField object>, 'token': <django.forms.fields.CharField object>}
declared_fields = {'code': <django.forms.fields.CharField object>}
property media
class scipost.forms.AuthorshipClaimForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.forms.Form

base_fields = {'claim': <django.forms.fields.ChoiceField object>}
declared_fields = {'claim': <django.forms.fields.ChoiceField object>}
property media
class scipost.forms.UnavailabilityPeriodForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

model

alias of scipost.models.UnavailabilityPeriod

fields = ['start', 'end']
clean_end()[source]
base_fields = {'end': <django.forms.fields.DateField object>, 'start': <django.forms.fields.DateField object>}
declared_fields = {}
property media
class scipost.forms.ContributorMergeForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.forms.Form

clean()[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__’.

save()[source]

Merge one Contributor into another. Set the previous Contributor to inactive.

base_fields = {'to_merge': <common.forms.ModelChoiceFieldwithid object>, 'to_merge_into': <common.forms.ModelChoiceFieldwithid object>}
declared_fields = {'to_merge': <common.forms.ModelChoiceFieldwithid object>, 'to_merge_into': <common.forms.ModelChoiceFieldwithid object>}
property media
class scipost.forms.RemarkForm(*args, **kwargs)[source]

Bases: django.forms.forms.Form

base_fields = {'remark': <django.forms.fields.CharField object>}
declared_fields = {'remark': <django.forms.fields.CharField object>}
property media
scipost.forms.get_date_filter_choices()[source]
class scipost.forms.SearchTextForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.forms.Form

Simple text-based search form.

base_fields = {'text': <django.forms.fields.CharField object>}
declared_fields = {'text': <django.forms.fields.CharField object>}
property media
class scipost.forms.EmailGroupMembersForm(*args, **kwargs)[source]

Bases: django.forms.forms.Form

base_fields = {'email_subject': <django.forms.fields.CharField object>, 'email_text': <django.forms.fields.CharField object>, 'group': <django.forms.models.ModelChoiceField object>, 'include_scipost_summary': <django.forms.fields.BooleanField object>, 'personalize': <django.forms.fields.BooleanField object>}
declared_fields = {'email_subject': <django.forms.fields.CharField object>, 'email_text': <django.forms.fields.CharField object>, 'group': <django.forms.models.ModelChoiceField object>, 'include_scipost_summary': <django.forms.fields.BooleanField object>, 'personalize': <django.forms.fields.BooleanField object>}
property media
class scipost.forms.EmailParticularForm(*args, **kwargs)[source]

Bases: django.forms.forms.Form

base_fields = {'email_address': <django.forms.fields.EmailField object>, 'email_subject': <django.forms.fields.CharField object>, 'email_text': <django.forms.fields.CharField object>, 'include_scipost_summary': <django.forms.fields.BooleanField object>}
declared_fields = {'email_address': <django.forms.fields.EmailField object>, 'email_subject': <django.forms.fields.CharField object>, 'email_text': <django.forms.fields.CharField object>, 'include_scipost_summary': <django.forms.fields.BooleanField object>}
property media
class scipost.forms.EmailUsersForm(*args, **kwargs)[source]

Bases: django.forms.forms.Form

save()[source]
base_fields = {'email_subject': <django.forms.fields.CharField object>, 'email_text': <django.forms.fields.CharField object>, 'personalize': <django.forms.fields.BooleanField object>, 'users': <django.forms.models.ModelMultipleChoiceField object>}
declared_fields = {'email_subject': <django.forms.fields.CharField object>, 'email_text': <django.forms.fields.CharField object>, 'personalize': <django.forms.fields.BooleanField object>, 'users': <django.forms.models.ModelMultipleChoiceField object>}
property media
class scipost.forms.SendPrecookedEmailForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.forms.Form

base_fields = {'email_address': <django.forms.fields.EmailField object>, 'email_option': <django.forms.models.ModelChoiceField object>, 'from_address': <django.forms.fields.ChoiceField object>, 'include_scipost_summary': <django.forms.fields.BooleanField object>}
declared_fields = {'email_address': <django.forms.fields.EmailField object>, 'email_option': <django.forms.models.ModelChoiceField object>, 'from_address': <django.forms.fields.ChoiceField object>, 'include_scipost_summary': <django.forms.fields.BooleanField object>}
property media
class scipost.forms.ConfirmationForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: django.forms.forms.Form

base_fields = {'confirm': <django.forms.fields.ChoiceField object>}
declared_fields = {'confirm': <django.forms.fields.ChoiceField object>}
property media