summaryrefslogtreecommitdiff
path: root/doc/django.rst
blob: 2117c21432fd18470be22d4680f6df59896c15c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Interaction with Django
=======================

.. module:: semantic_version.django_fields

The ``python-semanticversion`` package provides three custom fields for Django:

- :class:`VersionField`: stores a :class:`semantic_version.Version` object
- :class:`SpecItemField`: stores a :class:`semantic_version.SpecItem` object
- :class:`SpecField`: stores a :class:`semantic_version.Spec` object

Those fields are :class:`django.db.models.CharField` subclasses,
with their :attr:`~django.db.models.CharField.max_length` defaulting to 200.


.. class:: VersionField

    Stores a :class:`semantic_version.Version` as its string representation.

    .. attribute:: partial

        Boolean; whether :attr:`~semantic_version.Version.partial` versions are allowed.


.. class:: SpecItemField

    Stores a :class:`semantic_version.SpecItem` as its string representation.


.. class:: SpecField

    Stores a :class:`semantic_version.Spec` as its comma-separated string representation.