Common Features — Django-Vitae 0.0.1 documentation

# Common Features

Publications, regardless of type, all have some common traits such as titles and lists of authors. Django-Vitae defines a number of common features across the four different types of publications. Internally, Django-Vitae does this by defining a series of abstract classes. The different publication models inherit from the `VitaePublicationModel` abstract model.

## Common Fields

The following fields are common across the four types of publications:

`title`
  The title of the publication (required).
`short_title`

  A shortened title of the publication with a maximum length of 80 characters (required).

  This can be the “running head” of a publication. Django-Vitae uses the slugified version of the short title to construct URLs for the item.

`slug`

  A slugified version of the short-title to use in URLs (required).

  The slugs are automatically constructed from the `short_title` in `admin`.

`status`

  The point in the publication process where the publication currently rests (required).

  All publication models include an `status` field, which represents the where in publication process the publication currently exists. Django-Vitae implements the `status` field by using an `IntegerField` with the `choices` parameter defined in `CV_PUBLICATION_STATUS_CHOICES`. The default values of the `PUBLICATION_STATUS_CHOICES` setting are:

  Integer | Status
  --- | ---
  0 | In preparation
  1 | Working paper
  20 | Submitted
  30 | Revision for resubmission invited
  35 | Resubmitted
  40 | Conditionally accepted
  50 | Forthcoming
  55 | In press
  60 | Published
  99 | “Resting”

  A user may customize the integer values and labels by defining their own `CV_PUBLICATION_STATUS` option in their `settings.py` file.

`pub_date`
  The date that the publication was published in final form.
`primary_discipline`

  The discipline to which the publication contributes most directly.

  A `ForeignKey` relationship to a `cv.models.Discipline` object. Can be useful for researchers who work in multiple disciplines to separate their CV into sections for each discipline.

`other_disciplines`

  Disciplines other than the primary discipline to which the publication contributes.

  A `ManyToManyField` relationship to `cv.models.Discipline` objects.

Each publication model contains two non-editable fields managed internally that can be accessed for instances of the model:

- `abstract_html` that converts text entered in Markdown in
    `abstract` field to html, and
- `is_published` that indicates whether `status` field is
    one of “Forthcoming,” “In Press,” or “Published”.

## Ordering

The publication models order model instances by `status` in ascending order then by `pub_date` in descending order. This places the publications with the highest probability of changing at the top of sorted lists.

Note

The publication models do not use `pub_date` field to identify published articles and the built-in templates do not print the `pub_date` field. Therefore, users can use the `pub_date` field to order unpublished manuscripts in a convenient order.

## Managers

For all types of publications, users may access instances of publication with the `displayable` custom manager. In addition to the `all()` method that returns all objects for which the `display` attribute is `True`, the manager also includes three other methods:

`published`
  returns all publications that have been accepted for publication or published (forthcoming, in press, and published).

`revise`
  returns all publications that are in the process of submission or revision (submitted, under revision for resubmission, resubmitted, or conditionally accepted).

`inprep`
  returns all publications being prepared for submission and publication.

Note

The custom managers the include multiple statuses retain the default ordering of the model (that is, they are ordered by `status`, then `pub_date`, then `submission_date`).

## Authorship Sets

Publication types also share the common trait of having authors. More precisely, publications have authorships since a list of authors contains information, such as the order of authorship.

For all publication type models, Django-Vitae includes an `authorship` attribute that returns a `QuerySet` of authorships, e.g.:

    >>> from cv.models import Article
    >>> article = Article.objects.all().first()
    >>> article.authorship.all()
    <QuerySet [<ArticleAuthorship: Kahneman, Daniel>,
       <ArticleAuthorship: Tversky, Amos]>]

Internally, the authorship attributes are implemented as a `django.db.models.ManyToManyField` that relate an instance of the publication type (e.g., `Article`, `Book`, etc.) to `Collaborator` through a third model.

Authorship models for all publication types have three common fields:

`display_order`
  Integer that classifies the position of the author in the list of authors (required)
`print_middle`
  Boolean that indicates whether the author’s middle initials should be printed in list of authors (default=True)
`student_colleague`
  Choice field with possible values defined by CV_STUDENT_LEVELS_CHOICES setting; allows display of student collaborations

## Custom Methods

Each of the publication models includes the custom functions, `get_previous_published()` and `get_next_published()` that will return next and previous published instance of the model using the `pub_date` field.

Note

The `get_previous_published()` and `get_next_published()` functions are designed to emulate the Django built-in methods `get_next_by_FOO` and `get_next_by_FOO`