title: Boolean combination of attributes in Django
body: <p>I'm using Django to outline the relationship between university courses and high school subject requirements. </p>
  
  <p>So far I have the following models:</p>
  
  <blockquote>
  <pre><code>class Course(models.Model):
     title = models.CharField(max_length=100)    #(e.g. Bachelor of _____)
     ft_years = models.SmallPositiveIntegerField()    #years of full time study
  
  class Requirement(models.Model):    
     subject = models.CharField(max_length=50)    #(e.g. Mathematics 3)
     score = models.DecimalField(max_digits=3)    #(e.g. 70)       
     percent = models.NullBooleanField()    #True if score is in percent
  </code></pre>
  </blockquote>
  
  <p>My question is, how can I add a Boolean combination of Requirement to each Course?</p>
  
  <p>For example: </p>
  
  <blockquote>
    <p>A Bachelor of Physics (Course) has the following Requirements:<br>
    (70% in Physics) <strong>AND</strong> (50% in Mathematics 3 <strong>OR</strong> 45% in Mathematics 4)</p>
  </blockquote>
  
  <hr>
  
  <p><em>Additional info:</em> Because several courses may share the same requirement (e.g. 70% in Physics) but each course may have several requirements, I am planning to use a m2m model.</p>