title: How can I compare two dates in the database so that the next one starts with the previous one?
body: <p>I have model &quot;Education&quot; where the user must enter the years of study at the university. So I just wanna that when the user adds the year of the beginning of studing, the year of the end of studing cannot be lower than the year of the beginning of studing and must be within +10 years from the year of the beginning of studing.</p>
  <p>Now my models looks like that:</p>
  <p>My models:</p>
  <pre><code>def current_year():
      return datetime.date.today().year
  
  def max_value_current_year(value):
      return MaxValueValidator(current_year())(value)
  
  class Education(models.Model):
      name_university=models.CharField('University',max_length=300, blank=True)
      degree_of_edu=models.CharField('Degree of Education', max_length=25, blank=True)
      start_year=models.IntegerField('Start year',default=current_year(), validators=[MinValueValidator(1945), max_value_current_year])
      end_year=models.IntegerField('End year', default=current_year()+1,validators=[MinValueValidator(1945), MaxValueValidator(2100)])
      speciality=models.CharField('Speciality', default='Engineer', max_length=250, blank=True)
  
      def __str__(self):
          return '{}'.format(self.name_university)
  </code></pre>
  <p>I have understood that IntegerFields can't compere with each other, because i have gotten an error
  already like this:</p>
  <p>'&gt;' not supported between instances of 'int' and 'IntegerField'</p>
  <p>So for example: if u choosed or wrote: 2021, u would able to choose the end of studing only 2022-2031</p>
  <p>Or is it possible to do this at all only at the form stage?</p>