﻿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
978	STACKED ForeignKey classes don't show up in the admin for subclasses of related class	Arthur Hebert	nobody	"This is a simple problem that can be reproduced within one small model. I have five classes; one of them, '''Entity''', is basically used as an abstract class, and is subclassed by '''Company''' and '''Person'''. The two remaining classes are '''PhoneNumbe'''r and '''Email''', which are simple ''OneToMany'' relationships that point to '''Entity'''. In the call to ''ForeignKey()'', I specify that '''PhoneNumber''' and '''Email''' should have ''edit_inline=meta.STACKED'', however, they do not show up in the admin interface for either '''Company''' or '''Person'''. I really believe that they should show up. 

Here is the model code:

{{{
#####################################################
from django.core import meta

class Entity(meta.Model):
	# phones and emails are referenced to this class
	address = meta.TextField()
	notes = meta.TextField()
class PhoneNumber(meta.Model):
	entity = meta.ForeignKey(Entity, edit_inline=meta.STACKED, num_in_admin=2)
	number = meta.CharField(maxlength=20, core=True)
class Email(meta.Model):
	""""""An email address""""""
	entity = meta.ForeignKey(Entity, edit_inline=meta.STACKED, num_in_admin=1)
	email = meta.EmailField(core=True)
class Company(Entity):
	name = meta.CharField(maxlength=200)
	
	def __repr__(self):
		return self.name
	
	class META:
		admin = meta.Admin()
class Person(Entity):
	company = meta.ForeignKey(Company)
	
	first_name = meta.CharField(maxlength=30, core=True)
	last_name = meta.CharField(maxlength=30, core=True)
	
	def __repr__(self):
		return ""%s %s"" % (self.first_name, self.last_name)
	
	class META:
		admin = meta.Admin()
######################################################
}}}


It is structured this way, because there is no point in entering an '''Email''' or '''PhoneNumber''' outside the context of an '''Entity''', and it would be redundant to apply separate relationships to '''Company''' and '''Person''' classes, because they are inherently alike. Feel free to email me if I can clarify: funnylukin--at--yahoo--dot--com. I am still new to django (and python), so I don't have deeper insight into the source of the problem."	defect	closed	contrib.admin		normal	invalid			Design decision needed	0	0	0	0	0	0
