title: Django Save Override Throwing Primary Duplicate Errors
body: <p>So, I have a model called ScheduleItem</p>
  
  <pre><code>class ScheduleItem(models.Model):
        agreement = FK
        location = FK
        start = models.DateTimeField()
        end = models.DateTimeField()
        totalHours = DecimalField
  
        def get_total_hours(self):
              start = timedelta(hours=self.start.hour, minutes=self.start.minute)
              end = timedelta(hours=self.end.hour, minutes=self.end.minute)
              td = (end-start).seconds
              totalHours=Decimal(td/Decimal(60)/Decimal(60))
              return totalHours
  
       def save(self,*args,**kwargs):
            if self.pk == None:
                super(ScheduleItem,self).save(self,*args,**kwargs)
                self.refresh_from_db() # to access the datetime values, rather than unicode POST
                self.totalHours = self.get_total_hours()
            else:
                self.totalHours = self.get_total_hours()
  
            super(ScheduleItem,self).save(self,*args,**kwargs)
  </code></pre>
  
  <p>This throws PRIMARY key errors. I get duplicate entries with the second super(ScheduleItem,self). I cannot for the life of me figure out how to check for pk to access the datetime value and then save again within the save override method. I've tried moving things around, I've tried saving within the get_total_hours() function, with nothing but trouble.</p>
  
  <p>I just want the object to be committed to the db so I can get the datetime objects and then calculate the total hours. </p>
  
  <p>I'd rather not convert to datetime within the save function. </p>
  
  <p>Does anyone have any tip or can anyone tell me where I'm going wrong? </p>