comments.models module

class comments.models.Comment(*args, **kwargs)[source]

Bases: scipost.behaviors.TimeStampedModel

A Comment is an unsollicited note, submitted by a Contributor.

A Comment is pointed to a particular Publication, Report or in reply to an earlier Comment.

status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

vetted_by

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

file_attachment

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
content_type

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

object_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

content_object

Provide a generic many-to-one relation through the content_type and object_id fields.

This class also doubles as an accessor to the related object (similar to ForwardManyToOneDescriptor) by adding itself as a model attribute.

nested_comments

Accessor to the related objects manager on the one-to-many relation created by GenericRelation.

In the example:

class Post(Model):
    comments = GenericRelation(Comment)

post.comments is a ReverseGenericManyToOneDescriptor instance.

is_author_reply

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

author

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

anonymous

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_cor

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_rem

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_que

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_ans

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_obj

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_rep

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_val

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_lit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_sug

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

comment_text

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

remarks_for_editors

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

date_submitted

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

needs_doi

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

doideposit_needs_updating

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

genericdoideposit

Accessor to the related objects manager on the one-to-many relation created by GenericRelation.

In the example:

class Post(Model):
    comments = GenericRelation(Comment)

post.comments is a ReverseGenericManyToOneDescriptor instance.

doi_label

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.ManagerFromCommentQuerySet object>
property title

Get title of Submission if Comment is pointed to Submission.

core_content_object

Return object Comment is pointed to.

all_nested_comments()[source]

Returns a queryset of all nested comments (recursive).

property is_vetted

Check if Comment is vetted.

property is_unvetted

Check if Comment is awaiting vetting.

property is_rejected

Check if Comment is rejected.

property doi_string
create_doi_label()[source]
get_absolute_url()[source]
get_attachment_url()[source]
grant_permissions()[source]
get_author()[source]

Return Contributor instance of object if not anonymous.

get_author_str()[source]

Return author string if not anonymous.

property relation_to_published

Check if the Comment relates to a SciPost-published object. If it is, return a dict with info on relation to the published object, based on Crossref’s peer review content type.

property citation
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

author_id
commentaries

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

comments

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

content_type_id
get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)
get_next_by_date_submitted(*, field=<django.db.models.fields.DateTimeField: date_submitted>, is_next=True, **kwargs)
get_next_by_latest_activity(*, field=<scipost.db.fields.AutoDateTimeField: latest_activity>, is_next=True, **kwargs)
get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)
get_previous_by_date_submitted(*, field=<django.db.models.fields.DateTimeField: date_submitted>, is_next=False, **kwargs)
get_previous_by_latest_activity(*, field=<scipost.db.fields.AutoDateTimeField: latest_activity>, is_next=False, **kwargs)
get_status_display(*, field=<django.db.models.fields.SmallIntegerField: status>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

reports

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

submissions

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

theses

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

vetted_by_id