Skip to content

Commit d253dcb

Browse files
committed
update linkages in docs
1 parent b220b6c commit d253dcb

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

doc/source/index.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Django Enum
77
Full and natural support for enumerations_ as Django model fields.
88

99
Many packages aim to ease usage of Python enumerations as model fields. Most
10-
were made obsolete when Django provided ``TextChoices`` and ``IntegerChoices``
10+
were made obsolete when Django provided TextChoices_ and IntegerChoices_
1111
types. The motivation for django-enum was to:
1212

1313
* Always automatically coerce fields to instances of the Enum type.
@@ -19,10 +19,10 @@ types. The motivation for django-enum was to:
1919
* Represent enum fields with the smallest possible column type.
2020
* Be as simple and light-weight an extension to core Django as possible.
2121

22-
django-enum works in concert with Django_'s built in ``TextChoices`` and
23-
``IntegerChoices`` to provide a new model field type, ``EnumField``, that
22+
django-enum works in concert with Django_'s built in TextChoices_ and
23+
IntegerChoices_ to provide a new model field type, ``EnumField``, that
2424
resolves the correct native Django_ field type for the given enumeration based
25-
on its value type and range. For example, ``IntegerChoices`` that contain
25+
on its value type and range. For example, IntegerChoices_ that contain
2626
values between 0 and 32767 become `PositiveSmallIntegerField <https://docs.djangoproject.com/en/stable/ref/models/fields/#positivesmallintegerfield>`_.
2727

2828
.. code:: python
@@ -71,7 +71,7 @@ accessible as their enumeration type rather than by-value:**
7171
7272
7373
`django-enum <https://django-enum.readthedocs.io/en/latest/>`_ also provides
74-
``IntegerChoices`` and ``TextChoices`` types that extend from
74+
IntegerChoices_ and TextChoices_ types that extend from
7575
enum-properties_ which makes possible very rich enumeration fields.
7676

7777
.. code:: python

doc/source/refs.rst

+4
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@
1515
.. _enum-properties: https://pypi.org/project/enum-properties
1616
.. _django-filter: https://pypi.org/project/django-filter
1717
.. _DRF: https://www.django-rest-framework.org
18+
.. _Choices: https://docs.djangoproject.com/en/4.1/ref/models/fields/#enumeration-types
19+
.. _TextChoices: https://docs.djangoproject.com/en/4.1/ref/models/fields/#enumeration-types
20+
.. _IntegerChoices: https://docs.djangoproject.com/en/4.1/ref/models/fields/#enumeration-types
21+
1822

doc/source/usage.rst

+16-16
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ simple declarative syntax are possible with ``EnumField``. See
6969
External Enum Types
7070
###################
7171

72-
``Enum`` classes defined externally to your code base or enum classes that
73-
otherwise do not inherit from Django's ``Choices`` type, are supported. When no
74-
choices are present on an ``Enum`` type, ``EnumField`` will attempt to use the
72+
Enum_ classes defined externally to your code base or enum classes that
73+
otherwise do not inherit from Django's Choices_ type, are supported. When no
74+
choices are present on an Enum_ type, ``EnumField`` will attempt to use the
7575
``label`` member on each enumeration value if it is present, otherwise the
7676
labels will be based off the enumeration name. Choices can also be overridden
7777
at the ``EnumField`` declaration.
7878

79-
In short, ``EnumField`` should work with any subclass of ``Enum``.
79+
In short, ``EnumField`` should work with any subclass of Enum_.
8080

8181
.. code:: python
8282
@@ -98,8 +98,8 @@ The above code will produce a choices set like ``[('V0', 'VALUE0'), ...]``.
9898
9999
.. warning::
100100
101-
One nice feature of Django's ``Choices`` type is that it disables
102-
``auto()`` on ``Enum`` fields. ``auto()`` can be dangerous because the
101+
One nice feature of Django's Choices_ type is that it disables
102+
``auto()`` on Enum_ fields. ``auto()`` can be dangerous because the
103103
values assigned depend on the order of declaration. This means that if the
104104
order changes existing database values will no longer align with the
105105
enumeration values. When using ``Enums`` where control over the values is
@@ -121,13 +121,13 @@ The following ``EnumField`` specific parameters are available:
121121

122122
By default all ``EnumFields`` are ``strict``. This means a ``ValidationError``
123123
will be thrown anytime full_clean is run on a model and a value is set for the
124-
field that can not be coerced to its native ``Enum`` type. To allow the field
125-
to store values that are not present in the fields ``Enum`` type we can pass
124+
field that can not be coerced to its native Enum_ type. To allow the field
125+
to store values that are not present in the fields Enum_ type we can pass
126126
`strict=False`.
127127

128128
Non-strict fields that have values outside of the enumeration will be instances
129-
of the enumeration where a valid ``Enum`` value is present and the plain old
130-
data where no ``Enum`` type coercion is possible.
129+
of the enumeration where a valid Enum_ value is present and the plain old
130+
data where no Enum_ type coercion is possible.
131131

132132
.. code-block:: python
133133
@@ -164,9 +164,9 @@ data where no ``Enum`` type coercion is possible.
164164
----------
165165

166166
Setting this parameter to ``False`` will turn off the automatic conversion to
167-
the field's ``Enum`` type while leaving all validation checks in place. It will
168-
still be possible to set the field directly as an ``Enum`` instance and to
169-
filter by ``Enum`` instance or any symmetric value:
167+
the field's Enum_ type while leaving all validation checks in place. It will
168+
still be possible to set the field directly as an Enum_ instance and to
169+
filter by Enum_ instance or any symmetric value:
170170

171171
.. code-block:: python
172172
@@ -193,7 +193,7 @@ filter by ``Enum`` instance or any symmetric value:
193193
enum-properties
194194
###############
195195

196-
``TextChoices`` and ``IntegerChoices`` types are provided that extend Django_'s
196+
TextChoices_ and IntegerChoices_ types are provided that extend Django_'s
197197
native choice types with support for enum-properties_. The dependency on
198198
enum-properties_ is optional, so to utilize these classes you must separately
199199
install enum-properties_:
@@ -426,7 +426,7 @@ Migrations
426426
work with the primitive values instead*.
427427

428428
The deconstructed ``EnumFields`` only include the choices tuple in the
429-
migration files. This is because ``Enum`` classes may come and go or be
429+
migration files. This is because Enum_ classes may come and go or be
430430
altered but the earlier migration files must still work. Simply treat any
431431
custom migration routines as if they were operating on a normal model field
432432
with choices.
@@ -438,7 +438,7 @@ are with any field with choices.
438438
Performance
439439
###########
440440

441-
The cost to resolve a raw database value into an ``Enum`` type object is
441+
The cost to resolve a raw database value into an Enum_ type object is
442442
non-zero. ``EnumFields`` may not be appropriate for use cases at the very edge
443443
of critical performance targets, but for most scenarios the cost of using
444444
``EnumFields`` is negligible.

0 commit comments

Comments
 (0)