mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #24099 -- Removed contenttype.name deprecated field
This finsishes the work started on #16803. Thanks Simon Charette, Tim Graham and Collin Anderson for the reviews.
This commit is contained in:
parent
374c2419e5
commit
b4ac232907
15 changed files with 110 additions and 49 deletions
|
@ -59,7 +59,7 @@ The ``ContentType`` model
|
|||
.. class:: ContentType
|
||||
|
||||
Each instance of :class:`~django.contrib.contenttypes.models.ContentType`
|
||||
has three fields which, taken together, uniquely describe an installed
|
||||
has two fields which, taken together, uniquely describe an installed
|
||||
model:
|
||||
|
||||
.. attribute:: app_label
|
||||
|
@ -74,12 +74,19 @@ The ``ContentType`` model
|
|||
|
||||
The name of the model class.
|
||||
|
||||
Additionally, the following property is available:
|
||||
|
||||
.. attribute:: name
|
||||
|
||||
The human-readable name of the model. This is taken from the
|
||||
The human-readable name of the content type. This is taken from the
|
||||
:attr:`verbose_name <django.db.models.Field.verbose_name>`
|
||||
attribute of the model.
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
Before Django 1.8, the ``name`` property was a real field on the
|
||||
``ContentType`` model.
|
||||
|
||||
Let's look at an example to see how this works. If you already have
|
||||
the :mod:`~django.contrib.contenttypes` application installed, and then add
|
||||
:mod:`the sites application <django.contrib.sites>` to your
|
||||
|
@ -96,9 +103,6 @@ created with the following values:
|
|||
* :attr:`~django.contrib.contenttypes.models.ContentType.model`
|
||||
will be set to ``'site'``.
|
||||
|
||||
* :attr:`~django.contrib.contenttypes.models.ContentType.name`
|
||||
will be set to ``'site'``.
|
||||
|
||||
.. _the verbose_name attribute: ../model-api/#verbose_name
|
||||
|
||||
Methods on ``ContentType`` instances
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue