title: Django Models - Conditionally adding an object to a ManyToManyField before saving
body: <p>The following does not quite work, its purpose is:</p>
  
  <p>Upon save, check for the existence of 'supervisor' in the 'operators', and add it too them if not.</p>
  
  <pre><code>class JobRecord(models.Model):
      """JobRecord model"""
  
      project             = models.ForeignKey(Project)
      date                = models.DateField()
      supervisor          = models.ForeignKey(User, related_name='supervisor_set')
  
      operators           = models.ManyToManyField(User, related_name='operators_set', help_text='Include the supervisor here also.')
  
      vehicles            = models.ManyToManyField(Vehicle, blank=True, null=True)
  
      def __unicode__(self):
          return u"%s - %s" % (self.project.name,  self.date.strftime('%b %d'))
  
      # --- over ride methods ---- #
  
      def save(self, **kwargs):
          # this must be done to get a pk
          super(JobRecord, self).save(**kwargs)
  
          # which makes this comparison possible
          if self.supervisor not in self.operators.__dict__:
              self.operators.add(self.supervisor)
  
          # it seems to get this far ok, but alas, the second save attempt
          # does not seem to work!
          print self.operators.values()
          super(JobRecord, self).save(**kwargs)
  </code></pre>
  
  <p>Thanks for your expertise, would be 'expert'!</p>