title: Django datetime validation Error?
body: <p>I have a model where i want to raise error when user puts backdates in date_fields or enter earlier dates to today.</p>
  
  <pre><code>class Leave_Management(models.Model):
          employee = models.ForeignKey('employeeModel', on_delete=models.CASCADE)
          name = models.CharField(max_length=50)
          reason = models.TextField(max_length=200)
          date_to = models.DateField(null=True)
          date_from = models.DateField(null=True)
  </code></pre>
  
  <p>forms.py </p>
  
  <pre><code>class LeaveForm(forms.ModelForm):
      class Meta:
          model = Leave_Management
          fields = ('__all__')
      def clean_date_to(self):
          date_to = self.cleaned_data.get('date_to')
          if not date_to &gt; datetime.date.today():
              raise ValidationError('Enter Valid Date')
          return date_to
  </code></pre>
  
  <p>I tried to write this validation code But its showing error <code>TypeError at /home/leave
  '&gt;' not supported between instances of 'NoneType' and 'datetime.date'</code></p>
  
  <p>print(<code>date_to</code>) showing just <code>date 2018-06-2</code> </p>
  
  <p><code>print(datetime.date.today())</code> showing like this <code>datetime.date(2018, 6, 20)</code></p>
  
  <p>what am i doing wrong?</p>