title: 'datetime.date' object has no attribute 'days' error while using timedelta
body: <p>Here I am writing property method to display the remaining leave days and total leave days.The total leave days are working fine but <code>def leave_remaining_days(self)</code> this is not working.
  I go this error</p>
  
  <blockquote>
    <p>'datetime.date' object has no attribute 'days'</p>
  </blockquote>
  
  <p>Here the problem is while returning the no.of days <code>return leave_remaining.days</code> but when i return <code>return leave_remaining</code> just then it works.</p>
  
  <p>How can I calculate the remaining leave days here ?</p>
  
  <p>Only if <code>leave.is_accepted</code> True then i want to calculate remaining days.</p>
  
  <p><strong>I want to decrease days <code>1</code> to the <code>end_day</code> by each day until</strong> </p>
  
  <p><strong><code>datetime.date.today() == self.end_day</code>.</strong></p>
  
  <p>EDIT: For this I used celery but this is also not working.Initially to check whether it works or not I set minutes=1 in the periodic task  but it doesn't works.</p>
  
  <p>models.py</p>
  
  <pre><code>class Leave(models.Model):
      staff = models.ForeignKey(get_user_model(),on_delete=models.CASCADE,related_name='staff')
      sub = models.CharField(max_length=300)
      msg = models.TextField()
      start_day = models.DateField()
      end_day = models.DateField()
      is_accepted = models.BooleanField(default=False)
      is_rejected = models.BooleanField(default=False)
  
      @property
      def leave_days(self):
          diff = self.end_day - self.start_day
          return diff.days
  
      @property
      def leave_remaining_days(self):
          if self.is_accepted and not datetime.date.today() &gt; self.end_day:
              leave_remaining = self.end_day - datetime.timedelta(days=1)
              return leave_remaining.days
  
  #changes
  from celery.schedules import crontab
  from celery.task import periodic_task
  @property
  @periodic_task(run_every=crontab(minute=1))
  def leave_remaining_day(self):
      if self.is_accepted and not datetime.date.today() &gt; self.end_day:
          leave_remaining = self.leave_days - 1
          return leave_remaining
  </code></pre>