Changes between Initial Version and Version 1 of Ticket #19255, comment 1


Ignore:
Timestamp:
Oct 2, 2015, 9:06:20 AM (9 years ago)
Author:
Tim Graham

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #19255, comment 1

    initial v1  
    22{{{
    33from django.db import models
    4 from django.contrib.contenttypes import generic
     4from django.contrib.contenttypes.fields import GenericForeignKey
    55from django.contrib.contenttypes.models import ContentType
    66
     
    99    content_type = models.ForeignKey(ContentType, related_name='content')
    1010    object_id = models.PositiveIntegerField()
    11     object = generic.GenericForeignKey()
     11    object = GenericForeignKey()
    1212
    1313    def clean(self):
    14         assert self.object_id
    1514        assert self.object_id
    1615
     
    2120Then I create a model admin for the other model:
    2221{{{
    23 from django.contrib.contenttypes import generic
     22from django.contrib.contenttypes.admin import GenericStackedInline
    2423from django.contrib import admin
    25 from testcase.models import Model, AnotherModel
    2624
    27 class ModelInline(generic.GenericStackedInline):
     25from .models import Model, AnotherModel
     26
     27class ModelInline(GenericStackedInline):
    2828    model = Model
    2929
Back to Top