Skip to content

Commit

Permalink
documented achievement models
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebader committed Dec 1, 2018
1 parent adf95ac commit aa22b46
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cv/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Collaborator, CollaborationModel, StudentCollaborationModel, \
Discipline, Journal

from .accomplishments import Award, Degree, Position
from .achievements import Award, Degree, Position

from .files import CVFile

Expand Down
4 changes: 2 additions & 2 deletions cv/models/accomplishments.py → cv/models/achievements.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Degree(DisplayableModel):
major = models.CharField(max_length=100, null=True, blank=True)
date_earned = models.DateField(_('Date Earned'))
institution = models.CharField(max_length=100)
city = models.CharField(max_length=100)
city = models.CharField(max_length=100, blank=True)
state = models.CharField(
_('State or Province'), max_length=100, blank=True)
country = models.CharField(max_length=100, blank=True)
Expand All @@ -63,7 +63,7 @@ class Position(DisplayableModel):
Positions are sorted by ``end_date``.
In addition to default managers of ``DisplayableModel``s, ``Position``
In addition to default managers of ``DisplayableModel``, ``Position``
also has a ``primarypositions`` manager that only returns positions
for which ``primary_position==True``. This manager can be used, for
example, to list positions in the heading of CVs.
Expand Down
5 changes: 1 addition & 4 deletions cv/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DisplayableModel(models.Model):
to all models that inherit from it that returns all instances where
``display==True``.
display : boolean (required)
display : boolean (required)
Indicates whether model instance should be displayed and returned by
:class:`cv.models.DisplayManager`. Defaults to ``True``.
Expand All @@ -37,9 +37,6 @@ class DisplayableModel(models.Model):
files : :class:`GenericRelation` to :class:`cv.models.CVFile`
Relates files to model.
.. note::
due to rules that Django uses to load managers, it will be defined as the
default manager)
"""
display = models.BooleanField(default=True)
extra = models.TextField(blank=True)
Expand Down
1 change: 1 addition & 0 deletions cv/models/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class PrimaryPositionManager(models.Manager):
"""

def get_queryset(self):
"""Return positions user indicated as 'primary' positions."""
return super(PrimaryPositionManager, self).get_queryset().filter(
primary_position=True)

15 changes: 9 additions & 6 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The latest development version can be obtained from `GitHub`_::
$ cd django-vitae
$ python setup.py install

.. _GitHub: https://github.com/mikebader/django-vitae
.. _GitHub: https://github.com/mikebader/django-vitae/tree/dev

If you do not have experience with Django_, you might be interested in the :ref:`Getting Started <getting-started>` guide.

Expand All @@ -47,16 +47,19 @@ Organization of the Documentation
* :doc:`CV Sections <topics/index>` documents the API to write lines on CV by
different sections on a CV

* Education & Employment
* :doc:`Achievements <topics/achievements/index/>`
(:ref:`Degrees <topics-achievements-degrees>` |
:ref:`Positions <topics-achievements-positions>` |
:ref:`Awards <topics-achievements-awards>`)

* :doc:`Publications <topics/publications/index/>` (
:ref:`Articles <topics-pubs-articles>` |
* :doc:`Publications <topics/publications/index/>`
(:ref:`Articles <topics-pubs-articles>` |
:ref:`Books <topics-pubs-books>` |
:ref:`Chapters <topics-pubs-chapters>` |
:ref:`Reports <topics-pubs-reports>`)

* :doc:`Other Works <topics/works/index/>` (
:ref:`Grants <topics-works-grants>` |
* :doc:`Other Works <topics/works/index/>`
(:ref:`Grants <topics-works-grants>` |
:ref:`Talks <topics-works-talks>` |
:ref:`Other Writing <topics-works-otherwriting>` |
:ref:`Datasets <topics-works-datasets>`)
Expand Down
5 changes: 5 additions & 0 deletions docs/source/reference/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

Reference for :mod:`cv.models` generated from docstrings.

Achievements
============
.. automodule:: cv.models.achievements
:members:

Publications
============
.. automodule:: cv.models.publications
Expand Down
58 changes: 58 additions & 0 deletions docs/source/topics/achievements/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Achievements
============

The first sections of CVs list one's achievements. The models below allow CV authors to record these achievements.


.. _topics-achievements-degrees:

Degrees
-------

The :class:`~cv.models.achievements.Degree` model stores instances of degrees earnned and has three required fields:

* :attr:`degree`

* :attr:`date_earned`

* :attr:`institution` that granted the degree

The :class:`Degree` model inherits from :class:`~cv.models.base.DisplayableModel` and therefore has an :attr:`extra` field that can be used to enter information about the degree. For the special case of honors, the :class:`Degree` model has a field, :attr:`honors`, that allows information such as whether a degree was attained *cum laude*.

Model instances are sorted in reverse chronological order using the :attr:`date_earned` values.


.. _topics-achievements-positions:

Positions
---------

The :class:`~cv.models.achievements.Position` model stores instances of jobs or research experience and has three required fields

* :attr:`title`

* :attr:`start_date`

* :attr:`institution`

The model also contains fields that allow the user to specify the :attr:`department` in which the user worked, as well as a :attr:`project` within the department.

Model instances are sorted in reverse chronological order by the :attr:`end_date` field first and the :attr:`start_date` second.

The model also has a Boolean field :attr:`primary_position` that allows the user to indicate if the position represents the primary title. The :attr:`primary_position` field is used, for example, in the heading of the :ref:`HTML <views-html>` and :ref:`PDF <views-pdf>` views. The model also comes with a :attr:`primary_position` manager that accesses the :class:`~cv.models.managers.PrimaryPositionManager` that returns only :class:`Position` instances marked as being primary positions.


.. _topics-achievements-awards:

Awards
------

The :class:`~cv.models.achievements.Award` model stores instances of honors or awards that the user has received. The model has three required fields:

* :attr:`name` of the award

* :attr:`organization` that grants the award

* :attr:`date` of award

The model also has a :attr:`description` field that can be used to provide more information about the award.
3 changes: 2 additions & 1 deletion docs/source/topics/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ CV Sections
:maxdepth: 1
:caption: Contents:

achievements/index
publications/index
works/index
works/index
2 changes: 1 addition & 1 deletion docs/source/topics/works/talks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The :class:`~cv.models.works.Talk` class contains a foreign key field, :attr:`ar

The :class:`~cv.models.works.Talk` model also contains a convenience method, :meth:`~cv.models.works.Talk.get_latest_presenation` that returns the :class:`~cv.models.works.Presentation` instance of the talk that was most recently performed (using the :attr:`presentation_date` field).

.. _topics_talks_views
.. _topics-talks-views:

Talk Views
^^^^^^^^^^
Expand Down

0 comments on commit aa22b46

Please sign in to comment.