summaryrefslogtreecommitdiff
path: root/tests/custom_managers
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2014-01-22 01:43:33 -0500
committerSimon Charette <charette.s@gmail.com>2014-01-26 14:42:30 -0500
commit10e3faf191d8f230dde8534d1c8fad8c8717816e (patch)
tree26d597787a0a22f0f11b1d1e0daf0c3b1feb5805 /tests/custom_managers
parentc3881944e8651ad98e29561154186e87928ca319 (diff)
downloaddjango-10e3faf191d8f230dde8534d1c8fad8c8717816e.tar.gz
Fixed #19774 -- Deprecated the contenttypes.generic module.
It contained models, forms and admin objects causing undesirable import side effects. Refs #16368. Thanks to Ramiro, Carl and Loïc for the review.
Diffstat (limited to 'tests/custom_managers')
-rw-r--r--tests/custom_managers/models.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/custom_managers/models.py b/tests/custom_managers/models.py
index 238124a265..bbf037b362 100644
--- a/tests/custom_managers/models.py
+++ b/tests/custom_managers/models.py
@@ -11,7 +11,9 @@ returns.
from __future__ import unicode_literals
-from django.contrib.contenttypes import generic
+from django.contrib.contenttypes.fields import (
+ GenericForeignKey, GenericRelation
+)
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@@ -88,7 +90,7 @@ class Person(models.Model):
favorite_book = models.ForeignKey('Book', null=True, related_name='favorite_books')
favorite_thing_type = models.ForeignKey('contenttypes.ContentType', null=True)
favorite_thing_id = models.IntegerField(null=True)
- favorite_thing = generic.GenericForeignKey('favorite_thing_type', 'favorite_thing_id')
+ favorite_thing = GenericForeignKey('favorite_thing_type', 'favorite_thing_id')
objects = PersonManager()
fun_people = FunPeopleManager()
@@ -110,7 +112,7 @@ class FunPerson(models.Model):
favorite_book = models.ForeignKey('Book', null=True, related_name='fun_people_favorite_books')
favorite_thing_type = models.ForeignKey('contenttypes.ContentType', null=True)
favorite_thing_id = models.IntegerField(null=True)
- favorite_thing = generic.GenericForeignKey('favorite_thing_type', 'favorite_thing_id')
+ favorite_thing = GenericForeignKey('favorite_thing_type', 'favorite_thing_id')
objects = FunPeopleManager()
@@ -127,10 +129,10 @@ class Book(models.Model):
authors = models.ManyToManyField(Person, related_name='books')
fun_authors = models.ManyToManyField(FunPerson, related_name='books')
- favorite_things = generic.GenericRelation(Person,
+ favorite_things = GenericRelation(Person,
content_type_field='favorite_thing_type', object_id_field='favorite_thing_id')
- fun_people_favorite_things = generic.GenericRelation(FunPerson,
+ fun_people_favorite_things = GenericRelation(FunPerson,
content_type_field='favorite_thing_type', object_id_field='favorite_thing_id')
def __str__(self):