title: Incorporate third-party module into Django models
body: <p>I'm creating a product ID conversion app. I have two models representing the two ID styles:</p>
  
  <pre><code>class Id1(models.Model):
      number = models.CharField(max_length=10)
      converted = models.CharField(max_length=13)
      status = models.CharField(max_length=5) # validation status
      error = models.CharField(max_length=10) # error message
  
      def __unicode__(self):
          return self.number
  
  class Id2(models.Model):
      number = models.CharField(max_length=13)
      converted = models.CharField(max_length=10)
      status = models.CharField(max_length=5) # validation status
      error = models.CharField(max_length=10) # error message
  
      def __unicode__(self):
          return self.number
  </code></pre>
  
  <p>There is a third-party Python (non-Django) module that I'd like to incorporate into the Django models for two reasons: </p>
  
  <ol>
  <li>It already provides the conversion functionality I need</li>
  <li>I want to use an OO approach in doing the conversion - I create an instance of a class (e.g. Id1) that encapsulates the relevant data and methods for that instance.</li>
  </ol>
  
  <p>The third-party module has the following classes with several fields and methods each:</p>
  
  <ul>
  <li>class Id(object)</li>
  <li>class Id1(Id)</li>
  <li>class Id2(Id)</li>
  </ul>
  
  <p>... and the following top-level functions which the class methods invoke:</p>
  
  <ul>
  <li>def validate</li>
  <li>def convert</li>
  <li>def calculate_checksum</li>
  <li>def cleanse</li>
  </ul>
  
  <p>However, I don't want the third-party module's attributes in the database; each database table should only contain the Django model fields (number and converted).</p>
  
  <p>How can this be achieved? If this isn't possible, what are some alternative ways to approach this problem? Delegate logic to the view?</p>
  
  <p><strong>[EDIT]</strong> I forgot to add that I'd like to use the module methods to initialize some of the fields like "converted", "status", and "error". Any idea how to do this?</p>