title: Django model polymorphism, using proxy inheritance
body: <p>This might sound like a duplicate, but I don't think it is.</p>
  
  <p>I need to do something a bit similar to what the asker did there : <a href="https://stackoverflow.com/questions/7526088/django-model-polymorphism-with-proxy-inheritance">django model polymorphism with proxy inheritance</a></p>
  
  <p>My parent needs to implement a set of methods, let's call them MethodA(), MethodB(). These methods will never be used directly, they will always be called through child models (but no, abstract class is not the way to go for various reasons).</p>
  
  <p>But this is where it becomes trickier :</p>
  
  <p>Each child model inherits from a specific module (moduleA, moduleB), they all implement the same method names but do something different. The calls are made through the parent model, and are redirected to the childs depending on the values of a field</p>
  
  <p>Since I guess it's not very clear, here is some pseudo-code to help you understand</p>
  
  <pre><code>from ModuleA import CustomClassA
  from ModuleB import CustomClassB
  
  class ParentModel(models.Model):
  
  TYPE_CHOICES = (
    ('ChildModelA', 'A'),
    ('ChildModelB', 'B'),
  )
  
      #some fields
      type = models.CharField(max_length=1, choices=TYPE_CHOICES)
      def __init__(self, *args, **kwargs):
          super(ParentModel, self).__init__(*args, **kwargs)
          if self.type:
            self.__class__ = getattr(sys.modules[__name__], self.type)
  
      def MethodA():
        some_method()
  
      def MethodB():
        some_other_method()
  
  class ChildModelA(ParentModel, CustomClassA):
      class Meta:
        proxy = True
  
  class ChildModelB(ParentModel, CustomClassB):
      class Meta:
        proxy = True
  </code></pre>
  
  <p>In ModuleA :</p>
  
  <pre><code>class CustomClassA():
      def some_method():
        #stuff
  
      def some_other_method():
        #other stuff
  </code></pre>
  
  <p>In ModuleB :</p>
  
  <pre><code>class CustomClassB():
      def some_method():
        #stuff
  
      def some_other_method():
        #other stuff
  </code></pre>
  
  <p>Right now, the problem is that the class change works, but it does not inherit from ChildModelA or B.</p>
  
  <p>Is this even possible? If yes, how can I make it work, and if no, how could I do this elegantly, without too much repetition?</p>