Metaclasses to the rescue (?)

class AjaxMroFixer(type):

    def mro(cls):
        classes = type.mro(cls)
        # Move AjaxyFormMixin to one before last that
        # has a 'post' method defined.
        new_list = [c for c in classes if c is not AjaxyFormMixin]
        have_post = [c for c in new_list if 'post' in c.__dict__]
        last = have_post[-1]
        new_list.insert(new_list.index(last), AjaxyFormMixin)
        return new_list

(Don't do this!)

6
class AjaxMroFixer(type): def mro(cls): classes = type.mro(cls) # Move AjaxyFormMixin to one before last that # has a 'post' method defined. new_list = [c for c in classes if c is not AjaxyFormMixin] have_post = [c for c in new_list if 'post' in c.__dict__] last = have_post[-1] new_list.insert(new_list.index(last), AjaxyFormMixin) return new_list