title: Model of database for spare parts in django
body: <p>I'm trying to figure out how to model the database for a spare part app.</p>
  
  <p>Main concern now is the quantity of each part. Some are in pieces, meters, Kg and so on. Some parts needs decimals and some should not have decimals.</p>
  
  <p>This is my raw idea of a basic model.</p>
  
  <pre><code>class Part(models.Model):
      name = models.CharField(max_length=550)
  
  class PartNumber(models.Model):
      partnumber = models.CharField(max_length=50)
      part = models.ManyToManyField(Part, related_name='partnumber')
  
  class Unit(models.Model):
      name = models.CharField(max_length=50)
      si_unit = models.CharField(max_length=10)
  
  class Stock(models.Model):
      quantity = models.DecimalField(max_digits=10, decimal_places=2)
      unit = models.ManyToManyField(Unit, related_name='unit')
      part = models.ManyToManyField(Part, related_name='part')
  </code></pre>
  
  <p>Problem is how I should solve the 'quantity' in 'Stock'. Is it better to have two fields? It does not feel right that way either.</p>