﻿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
1836	Decouple Admin inner class from Model	daekharel@…	Adrian Holovaty	"django.db.models.Model's add_to_class method contains logic for handling Admin inner classes:
{{{
    def add_to_class(cls, name, value):
        if name == 'Admin':
            assert type(value) == types.ClassType, ""%r attribute of %s model must be a class, not a %s object"" % (name, cls.__name__, type(value))
            value = AdminOptions(**dict([(k, v) for k, v in value.__dict__.items() if not k.startswith('_')]))
        if hasattr(value, 'contribute_to_class'):
            value.contribute_to_class(cls, name)
        else:
            setattr(cls, name, value)
}}}
Ideally, this logic would be separated from the Model class. I don't know how this could be done without changing the way Admin inner classes work (e.g. by requiring them to subclass some other class which did the work that AdminOptions does here using metaclassing)."	defect	closed	Metasystem		normal	fixed			Design decision needed	0	0	0	0	0	0
