﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7713	newforms-admin has issues with model inheritance	zobbo	nobody	"You'll need to apply the patch in #7588 to test this, otherwise you'll just get a python traceback

Take the following class:
{{{
from django.db import models

# Create your models here.

from django.db import models 
import datetime 

class BaseModel(models.Model): 
    """"""Abstract class used for some common fields"""""" 
    created_at = models.DateTimeField(blank=True, default=datetime.datetime.now) 
    modified_at = models.DateTimeField(blank=True, default=datetime.datetime.now) 
    class Meta: 
        abstract = True 

class Item(BaseModel): 
    """"""Everything in the system - multi table inheritance"""""" 
    code = models.CharField(blank=True, max_length=15) # A shortname 
    description = models.CharField(blank=True, max_length=50) 

class ValuedItem(Item): 
    """"""This is an abstract base class for stuff with a value"""""" 
    value = models.FloatField(default=0.0) 
    class Meta: 
        abstract = True 

class PlayableItem(ValuedItem): 
    """"""Inheriting from our abstract ValuedItem class"""""" 
    funfactor = models.IntegerField(blank=True, null=True) # Amount of fun
    
    class Admin:
        pass
        
/* The admin stuff, normally in admin.py */

from django.contrib import admin
from django.contrib.admin.sites import AlreadyRegistered
    
class PlayableItemAdmin(admin.ModelAdmin) :
    model = PlayableItem
    list_display = ('code','description',)
    list_filter = ('code',)
    search_fields=('code','description')    

try:
    admin.site.register(PlayableItem, PlayableItemAdmin)
except AlreadyRegistered:
    pass
}}}
Now try and add a playable item through the admin interface. By default the item ptr appears and won't let you save the record until it's been filled in. And of course, you can't fill it in, because the item it needs to point to is not saved yet. I'd assume these ptr fields should be automatically hidden and filled in by the admin mechanism. Attached graphic of the form behaviour. 


"		closed	contrib.admin	newforms-admin		duplicate	newforms-admin model inheritance		Unreviewed	0	0	0	0	0	0
