mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
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.
This commit is contained in:
parent
c3881944e8
commit
10e3faf191
33 changed files with 1011 additions and 906 deletions
|
@ -1,4 +1,6 @@
|
|||
from django.contrib.contenttypes import generic
|
||||
from django.contrib.contenttypes.fields import (
|
||||
GenericForeignKey, GenericRelation
|
||||
)
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db import models
|
||||
|
||||
|
@ -7,7 +9,7 @@ class Award(models.Model):
|
|||
name = models.CharField(max_length=25)
|
||||
object_id = models.PositiveIntegerField()
|
||||
content_type = models.ForeignKey(ContentType)
|
||||
content_object = generic.GenericForeignKey()
|
||||
content_object = GenericForeignKey()
|
||||
|
||||
|
||||
class AwardNote(models.Model):
|
||||
|
@ -17,7 +19,7 @@ class AwardNote(models.Model):
|
|||
|
||||
class Person(models.Model):
|
||||
name = models.CharField(max_length=25)
|
||||
awards = generic.GenericRelation(Award)
|
||||
awards = GenericRelation(Award)
|
||||
|
||||
|
||||
class Book(models.Model):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue