title: How do I create a Django model field that evaluates based on other fields?
body: <p>I'll try to describe my problem with a simple example. Say I have items of type <code>Item</code> and every item relates to a certain type of <code>Category</code>. Now I can take any two items and combine into an itemcombo of type <code>ItemCombo</code>. This itemcombo relates to a certain category called <code>ComboCategory</code>. The <code>ComboCategory</code> is based on which categories the items relate to, therefore I'm not to keen on hardcoding the <code>combocategory</code> in <code>ItemCombo</code> in case the items categories would change. Can I somehow make <code>combocategory</code> a virtual field in <code>ItemCombo</code> that evaluates just in time?</p>
  
  <pre><code>class Category(models.Model):
      value = models.CharField(max_length=1)
  
  
  class Item(models.Model):
      value    = models.CharField(max_length=10)
      category = models.ForeignKey(Category)
  
  
  class ComboCategory(models.Model):
      category1 = models.ForeignKey(Category)
      category2 = models.ForeignKey(Category)
      value = models.CharField(max_length=1)
  
  
  class ItemCombo(models.Model):
      item1         = models.ForeignKey(Item)
      item2         = models.ForeignKey(Item)
      combocategory = models.ForeignKey(ComboCategory)
  </code></pre>