commentaries.forms module

class commentaries.forms.DOIToQueryForm(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

VALID_DOI_REGEXP = '(?i)10.\\d{4,9}/[-._;()/:A-Z0-9]+$'
clean_doi()[source]
request_published_article_form_prefill_data()[source]
base_fields = {'doi': <django.forms.fields.RegexField object>}
declared_fields = {'doi': <django.forms.fields.RegexField object>}
property media
class commentaries.forms.ArxivQueryForm(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

IDENTIFIER_PATTERN_NEW = '^[0-9]{4,}.[0-9]{4,5}v[0-9]{1,2}$'
IDENTIFIER_PATTERN_OLD = '^[-.a-z]+/[0-9]{7,}v[0-9]{1,2}$'
VALID_ARXIV_IDENTIFIER_REGEX = '(?:^[0-9]{4,}.[0-9]{4,5}v[0-9]{1,2}$)|(?:^[-.a-z]+/[0-9]{7,}v[0-9]{1,2}$)'
clean_identifier()[source]
request_arxiv_preprint_form_prefill_data()[source]
base_fields = {'identifier': <django.forms.fields.RegexField object>}
declared_fields = {'identifier': <django.forms.fields.RegexField object>}
property media
class commentaries.forms.RequestCommentaryForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

model

alias of commentaries.models.Commentary

fields = ['acad_field', 'specialties', 'approaches', 'title', 'author_list', 'pub_date', 'pub_abstract']
placeholders = {'pub_date': 'Format: YYYY-MM-DD'}
save(*args, **kwargs)[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 = {'acad_field': <django.forms.models.ModelChoiceField object>, 'approaches': <django.forms.fields.MultipleChoiceField object>, 'author_list': <django.forms.fields.CharField object>, 'pub_abstract': <django.forms.fields.CharField object>, 'pub_date': <django.forms.fields.DateField object>, 'specialties': <django.forms.models.ModelMultipleChoiceField object>, 'title': <django.forms.fields.CharField object>}
declared_fields = {}
property media
class commentaries.forms.RequestArxivPreprintForm(*args, **kwargs)[source]

Bases: commentaries.forms.RequestCommentaryForm

class Meta[source]

Bases: commentaries.forms.Meta

model

alias of commentaries.models.Commentary

fields = ['acad_field', 'specialties', 'approaches', 'title', 'author_list', 'pub_date', 'pub_abstract', 'arxiv_identifier']
clean_arxiv_identifier()[source]
save(*args, **kwargs)[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 = {'acad_field': <django.forms.models.ModelChoiceField object>, 'approaches': <django.forms.fields.MultipleChoiceField object>, 'arxiv_identifier': <django.forms.fields.CharField object>, 'author_list': <django.forms.fields.CharField object>, 'pub_abstract': <django.forms.fields.CharField object>, 'pub_date': <django.forms.fields.DateField object>, 'specialties': <django.forms.models.ModelMultipleChoiceField object>, 'title': <django.forms.fields.CharField object>}
declared_fields = {}
property media
class commentaries.forms.RequestPublishedArticleForm(*args, **kwargs)[source]

Bases: commentaries.forms.RequestCommentaryForm

class Meta[source]

Bases: commentaries.forms.Meta

fields = ['acad_field', 'specialties', 'approaches', 'title', 'author_list', 'pub_date', 'pub_abstract', 'journal', 'volume', 'pages', 'pub_DOI']
placeholders = {'pub_DOI': 'ex.: 10.21468/00.000.000000', 'pub_date': 'Format: YYYY-MM-DD'}
clean_pub_DOI()[source]
save(*args, **kwargs)[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 = {'acad_field': <django.forms.models.ModelChoiceField object>, 'approaches': <django.forms.fields.MultipleChoiceField object>, 'author_list': <django.forms.fields.CharField object>, 'journal': <django.forms.fields.CharField object>, 'pages': <django.forms.fields.CharField object>, 'pub_DOI': <django.forms.fields.CharField object>, 'pub_abstract': <django.forms.fields.CharField object>, 'pub_date': <django.forms.fields.DateField object>, 'specialties': <django.forms.models.ModelMultipleChoiceField object>, 'title': <django.forms.fields.CharField object>, 'volume': <django.forms.fields.CharField object>}
declared_fields = {}
property media
class commentaries.forms.VetCommentaryForm(*args, **kwargs)[source]

Bases: django.forms.forms.Form

Process an unvetted Commentary request.

This form will provide fields to let the user process a Commentary that is unvetted. On success, the Commentary is either accepted or deleted from the database.

Keyword arguments:

  • commentary_id – the Commentary.id to process (required)

  • user – User instance of the vetting user (required)

ACTION_MODIFY = 0
ACTION_ACCEPT = 1
ACTION_REFUSE = 2
COMMENTARY_ACTION_CHOICES = ((0, 'modify'), (1, 'accept'), (2, 'refuse (give reason below)'))
REFUSAL_EMPTY = 0
REFUSAL_PAPER_EXISTS = -1
REFUSAL_UNTRACEBLE = -2
REFUSAL_ARXIV_EXISTS = -3
COMMENTARY_REFUSAL_CHOICES = ((0, '-'), (-1, 'a commentary on this paper already exists'), (-2, 'this paper cannot be traced'), (-3, 'there exists a more revent version of this arXiv preprint'))
COMMENTARY_REFUSAL_DICT = {-3: 'there exists a more revent version of this arXiv preprint', -2: 'this paper cannot be traced', -1: 'a commentary on this paper already exists', 0: '-'}
clean(*args, **kwargs)[source]

Check valid form and keyword arguments given

clean_refusal_reason()[source]

refusal_reason field is required if action==refuse.

get_commentary()[source]

Return Commentary if available

get_refusal_reason()[source]

Return refusal reason

commentary_is_accepted()[source]
commentary_is_modified()[source]
commentary_is_refused()[source]
process_commentary()[source]

Vet the commentary or delete it from the database

base_fields = {'action_option': <django.forms.fields.ChoiceField object>, 'email_response_field': <django.forms.fields.CharField object>, 'refusal_reason': <django.forms.fields.ChoiceField object>}
declared_fields = {'action_option': <django.forms.fields.ChoiceField object>, 'email_response_field': <django.forms.fields.CharField object>, 'refusal_reason': <django.forms.fields.ChoiceField object>}
property media
class commentaries.forms.CommentarySearchForm(*args, **kwargs)[source]

Bases: django.forms.forms.Form

search_results()[source]

Return all Commentary objects according to search

base_fields = {'abstract': <django.forms.fields.CharField object>, 'author': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}
declared_fields = {'abstract': <django.forms.fields.CharField object>, 'author': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}
property media
class commentaries.forms.CommentaryListSearchForm(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

Search for Commentary specified by user (for old CommentaryListView)

search_results()[source]

Return all Commentary objects according to search

base_fields = {'abstract': <django.forms.fields.CharField object>, 'author': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}
declared_fields = {'abstract': <django.forms.fields.CharField object>, 'author': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}
property media
class commentaries.forms.CommentSciPostPublication(*args, **kwargs)[source]

Bases: comments.forms.CommentForm

This Form will let authors of a SciPost publication comment on their Publication using the Commentary functionalities. It will create a Commentary page if it does not exist yet.

It inherits from ModelForm: CommentForm and thus will, by default, return a Comment!

save(commit=True)[source]

Create (vetted) Commentary page if not exist and do save actions as per original CommentForm.

base_fields = {'anonymous': <django.forms.fields.BooleanField object>, 'comment_text': <django.forms.fields.CharField object>, 'file_attachment': <django.forms.fields.FileField object>, 'is_ans': <django.forms.fields.BooleanField object>, 'is_cor': <django.forms.fields.BooleanField object>, 'is_lit': <django.forms.fields.BooleanField object>, 'is_obj': <django.forms.fields.BooleanField object>, 'is_que': <django.forms.fields.BooleanField object>, 'is_rem': <django.forms.fields.BooleanField object>, 'is_rep': <django.forms.fields.BooleanField object>, 'is_sug': <django.forms.fields.BooleanField object>, 'is_val': <django.forms.fields.BooleanField object>, 'remarks_for_editors': <django.forms.fields.CharField object>}
declared_fields = {}
property media