﻿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
12568	SubFieldBase descriptor object should be accessible	Lars van de Kerkhof	nobody	"Currently any field that has SubFieldBase as a __metaclass__ will throw an exception if you try access the descriptor object without an instance.
Things like the following can not be done with the current implementation:


{{{
    def _get_members_of_type(obj, member_type):
        """"""
        Finds members of a certain type in obj.
        """"""
        def filter_member_type(member):
            try:
                return type(member) is member_type
            except AttributeError:
                return False
                
        # if the type of obj is the metaclass for all models, just search in the object
        # because it is not a model instance but a type
        if type(obj) is ModelBase:
            key_hash = inspect.getmembers(obj, filter_member_type)
        else:
            key_hash = inspect.getmembers(obj.__class__, filter_member_type)
            

        return key_hash
}}}

SubFieldBase will throw an AttributeError every time inspect.getmembers is used on a model instance or class.
Normal behaviour would be to return the descriptor object when no instance is passed. All django's standard fields 
behave this way, so it would be best if SubFieldBase would do the same.

I will attach a patch against current trunk."	Bug	closed	Forms	1.2-alpha	Normal	fixed	SubFieldBase subclassing		Accepted	1	0	1	0	0	0
