Django override model subclass create method
<p>I'm looking for right ways to override the <code>create()</code> method of a subclass.</p>

<p>Basically I'm doing this:</p>

<pre><code>class Base(models.Model):
    field1_base = models.IntegerField()
    def __init__(self, field1_base):
        # LOGICS
        self.field1_base = field1_base

class A(Base):
    field2_sub = models.IntegerField()
    def __init__(self, field2_sub, field1_base):
        # LOGICS
        self.field2_sub = field2_sub
        super(A, self).__init__(field1_base)

A(field2_sub=1, field1_base=2)
</code></pre>

<p>However we can't override the <code>__init__()</code> method of a model.</p>

<p>I just want to leave some fields to be assigned in base class's methods.</p>

<p>Is there a proper way to do this using <code>create()</code> method?</p>

<p>Of course I can custom <code>create</code> method of Base class, however what I want is to invoke Base.create and A.create at the same time on the creation of A, which makes the situation different from <a href="http://stackoverflow.com/questions/843580">this question</a></p>

<p>I would do something like this.</p>

<pre><code>class Base(models.Model):
    field1_base = models.IntegerField()

    def initialize(self, *args, **kwargs):
        self.field1_base = kwargs['field1_base']

    @classmethod
    def create(cls, *args, **kwargs):
        # LOGICS
        self = cls()
        self.initialize(*args, **kwargs)
        return self

class A(Base):
    field2_sub = models.IntegerField()

    def initialize(self, *args, **kwargs):
        super(A, self).initialize(*args, **kwargs)
        self.field2_sub = kwargs['field1_base']

A.create(field2_sub=1, field1_base=2)
</code></pre>

python django