title: DateField bigger than most recent record
body: <p>I have this DB table:</p>
  <p>models.py</p>
  <pre><code>class Payment(models.Model):
      date = models.DateField(blank=False,verbose_name=&quot;Data&quot;)
      description = models.CharField(max_length = 300,blank=False,verbose_name=&quot;Descrizione&quot;)
      course_subscription = models.ForeignKey(CourseSubscription,null=True,on_delete=models.CASCADE,verbose_name=&quot;Sottoscrizione Corso&quot;)
      payment_method = models.CharField(max_length = 4,blank=False,verbose_name=&quot;Modalità di pagamento&quot;,choices=PAYMENTS)
      value = models.DecimalField(max_digits=7, decimal_places=2,blank=False,verbose_name=&quot;Importo&quot;)
      receipt= models.FileField(blank=False,verbose_name=&quot;Ricevuta&quot;)
  </code></pre>
  <p>How can I add a constraint in model or form which allows the insertion of new payments only if the date is more recent than the most recent record? In other words, I want a new payment has always a more recent date than the last inserted one.</p>
  <p>I tried with:</p>
  <p>forms.py</p>
  <pre><code>class AddPaymentForm(forms.Form):
      def __init__(self, max_value, min_date, *args, **kwargs):
          super(AddPaymentForm, self).__init__(*args, **kwargs)
          self.fields['value'] = forms.DecimalField(  
              max_digits=7, 
              decimal_places=2,
              required=True,
              label=&quot;Importo&quot;,
              min_value=0.01,
              max_value=max_value,
              help_text= f&quot;Valore Massimo: {max_value}&quot;,
              widget = forms.NumberInput()
          )
  
          self.fields['date'] = forms.DateField(  
              required=True,
              label=&quot;Data&quot;,
              min_value=min_date,
              help_text= f&quot;Data minima: {min_date}&quot;,
              widget=forms.TextInput(
                  attrs={'type': 'date'} 
              )
          )
  
  ....
  </code></pre>
  <p>and
  views.py</p>
  <pre><code>...
      payments = Payment.objects.all().order_by('-date')
      initial = {
          'date': datetime.date.today().strftime(&quot;%Y-%m-%d&quot;),
          'member':member,
          'description': description,
          'value': 1.00,
          'subscription_type' :subscription_type,
          'subscription_id'   :subscription_id   
      }
      if len(payments)&gt;0 :
          min_date = payments[0].date.strftime(&quot;%Y-%m-%d&quot;)
          initial[&quot;date&quot;] = min_date
      else:
          min_date = None
      form = AddPaymentForm(
          initial= initial,
          max_value = remaining_fee,
          min_date = min_date
      )
  ...
  
  </code></pre>
  <p>This way works with 'value' field, but forms.DateField doesn't have &quot;min_value&quot; attribute.</p>