Changes between Initial Version and Version 1 of Ticket #19255, comment 1
- Timestamp:
- Oct 2, 2015, 9:06:20 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #19255, comment 1
initial v1 2 2 {{{ 3 3 from django.db import models 4 from django.contrib.contenttypes import generic4 from django.contrib.contenttypes.fields import GenericForeignKey 5 5 from django.contrib.contenttypes.models import ContentType 6 6 … … 9 9 content_type = models.ForeignKey(ContentType, related_name='content') 10 10 object_id = models.PositiveIntegerField() 11 object = generic.GenericForeignKey()11 object = GenericForeignKey() 12 12 13 13 def clean(self): 14 assert self.object_id15 14 assert self.object_id 16 15 … … 21 20 Then I create a model admin for the other model: 22 21 {{{ 23 from django.contrib.contenttypes import generic22 from django.contrib.contenttypes.admin import GenericStackedInline 24 23 from django.contrib import admin 25 from testcase.models import Model, AnotherModel26 24 27 class ModelInline(generic.GenericStackedInline): 25 from .models import Model, AnotherModel 26 27 class ModelInline(GenericStackedInline): 28 28 model = Model 29 29