mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Removed versionadded/changed notes for 1.7.
This commit is contained in:
parent
0e60912492
commit
c79faae761
64 changed files with 100 additions and 864 deletions
|
@ -242,8 +242,6 @@ the manager ``Person.people``.
|
|||
Creating ``Manager`` with ``QuerySet`` methods
|
||||
----------------------------------------------
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
In lieu of the above approach which requires duplicating methods on both the
|
||||
``QuerySet`` and the ``Manager``, :meth:`QuerySet.as_manager()
|
||||
<django.db.models.query.QuerySet.as_manager>` can be used to create an instance
|
||||
|
|
|
@ -477,12 +477,6 @@ There are a few restrictions on the intermediate model:
|
|||
:attr:`symmetrical=False <ManyToManyField.symmetrical>` (see
|
||||
:ref:`the model field reference <manytomany-arguments>`).
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
In Django 1.6 and earlier, intermediate models containing more than one
|
||||
foreign key to any of the models involved in the many-to-many relationship
|
||||
used to be prohibited.
|
||||
|
||||
Now that you have set up your :class:`~django.db.models.ManyToManyField` to use
|
||||
your intermediary model (``Membership``, in this case), you're ready to start
|
||||
creating some many-to-many relationships. You do this by creating instances of
|
||||
|
@ -1303,41 +1297,9 @@ inheritance hierarchies as simple and straightforward as possible so that you
|
|||
won't have to struggle to work out where a particular piece of information is
|
||||
coming from.
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
Before Django 1.7, inheriting from multiple models that had an ``id`` primary
|
||||
key field did not raise an error, but could result in data loss. For example,
|
||||
consider these models (which no longer validate due to the clashing ``id``
|
||||
fields)::
|
||||
|
||||
class Article(models.Model):
|
||||
headline = models.CharField(max_length=50)
|
||||
body = models.TextField()
|
||||
|
||||
class Book(models.Model):
|
||||
title = models.CharField(max_length=50)
|
||||
|
||||
class BookReview(Book, Article):
|
||||
pass
|
||||
|
||||
This snippet demonstrates how creating a child object overwrote the value of a
|
||||
previously created parent object::
|
||||
|
||||
>>> article = Article.objects.create(headline='Some piece of news.')
|
||||
>>> review = BookReview.objects.create(
|
||||
... headline='Review of Little Red Riding Hood.',
|
||||
... title='Little Red Riding Hood')
|
||||
>>>
|
||||
>>> assert Article.objects.get(pk=article.pk).headline == article.headline
|
||||
Traceback (most recent call last):
|
||||
File "<console>", line 1, in <module>
|
||||
AssertionError
|
||||
>>> # the "Some piece of news." headline has been overwritten.
|
||||
>>> Article.objects.get(pk=article.pk).headline
|
||||
'Review of Little Red Riding Hood.'
|
||||
|
||||
To properly use multiple inheritance, you can use an explicit
|
||||
:class:`~django.db.models.AutoField` in the base models::
|
||||
Note that inheriting from multiple models that have a common ``id`` primary
|
||||
key field will raise an error. To properly use multiple inheritance, you can
|
||||
use an explicit :class:`~django.db.models.AutoField` in the base models::
|
||||
|
||||
class Article(models.Model):
|
||||
article_id = models.AutoField(primary_key=True)
|
||||
|
|
|
@ -618,10 +618,6 @@ and with other ``F()`` objects. To find all the blog entries with more than
|
|||
|
||||
>>> Entry.objects.filter(n_comments__gt=F('n_pingbacks') * 2)
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
The power operator ``**`` was added.
|
||||
|
||||
To find all the entries where the rating of the entry is less than the
|
||||
sum of the pingback count and comment count, we would issue the
|
||||
query::
|
||||
|
@ -1149,8 +1145,6 @@ above example code would look like this::
|
|||
Using a custom reverse manager
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
By default the :class:`~django.db.models.fields.related.RelatedManager` used
|
||||
for reverse relations is a subclass of the :ref:`default manager <manager-names>`
|
||||
for that model. If you would like to specify a different manager for a given
|
||||
|
|
|
@ -314,16 +314,6 @@ Also note that Django expects the ``"%s"`` placeholder, *not* the ``"?"``
|
|||
placeholder, which is used by the SQLite Python bindings. This is for the sake
|
||||
of consistency and sanity.
|
||||
|
||||
.. versionchanged:: 1.7
|
||||
|
||||
:pep:`249` does not state whether a cursor should be usable as a context
|
||||
manager. Prior to Python 2.7, a cursor was usable as a context manager due
|
||||
an unexpected behavior in magic method lookups (`Python ticket #9220`_).
|
||||
Django 1.7 explicitly added support to allow using a cursor as context
|
||||
manager.
|
||||
|
||||
.. _`Python ticket #9220`: https://bugs.python.org/issue9220
|
||||
|
||||
Using a cursor as a context manager::
|
||||
|
||||
with connection.cursor() as c:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue