#1836: Decouple Admin inner class from Model ---------------------------------+------------------------------------------ Reporter: [EMAIL PROTECTED] | Owner: adrian Type: defect | Status: new Priority: low | Milestone: Component: Metasystem | Version: Severity: normal | Keywords: ---------------------------------+------------------------------------------ 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).
-- Ticket URL: <http://code.djangoproject.com/ticket/1836> Django <http://code.djangoproject.org/> The web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-updates -~----------~----~----~----~------~----~------~--~---