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
-
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']¶
-
-
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
-
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.
-
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
-
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
-
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.
-
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
-
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
¶
-
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
-
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
¶
-
Bases:
django.forms.models.ModelForm
Bases:
object
alias of
scipost.models.UnavailabilityPeriod
-
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__’.
-
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
¶
-
-
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
-
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
¶
-