title: django: How can i assign email_token_expiry datetime to null?
body: <pre><code>def confirmemail(request,token):
  
      user = Users.objects.get(email_token = token)
      if user:
          user.email_token = ''
          user.email_token_expiry = ''
          user.email_verified = 1
          user.active = 1
          user.save()
      return render_to_response('confirmemail.html', {'user': user}, context_instance=RequestContext(request))
  </code></pre>
  
  <p>I get error:</p>
  
  <pre><code>ValidationError at /confirmemail/mw054b7el2/
  
  [u'Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format.']
  
  Request Method:     GET
  Request URL:    http://127.0.0.1:8000/confirmemail/mw054b7el2/
  Django Version:     1.3.1
  Exception Type:     ValidationError
  Exception Value:    
  
  [u'Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format.']
  
  Exception Location:     /usr/local/lib/python2.6/dist-packages/django/db/models/fields/__init__.py in to_python, line 710
  Python Executable:  /usr/bin/python
  Python Version:     2.6.6
  Python Path:    
  
  ['/home/user1/djangoblog',
   '/usr/lib/python2.6',
   '/usr/lib/python2.6/plat-linux2',
   '/usr/lib/python2.6/lib-tk',
   '/usr/lib/python2.6/lib-old',
   '/usr/lib/python2.6/lib-dynload',
   '/usr/local/lib/python2.6/dist-packages',
   '/usr/lib/python2.6/dist-packages',
   '/usr/lib/python2.6/dist-packages/gst-0.10',
   '/usr/lib/pymodules/python2.6',
   '/usr/lib/pymodules/python2.6/gtk-2.0']
  </code></pre>
  
  <p><code>email_token_expiry</code> is a <code>datetime</code> field in mysql table.</p>
  
  <p>How can i set the <code>email_token_expiry</code> to null or empty or to the right formated null/0/empty datetime?</p>
  
  <p>It will be highly appreciated if someone help me to fix this problem.</p>
  
  <p>models.py:</p>
  
  <pre><code>class Users(models.Model):
      username = models.CharField(max_length=255,unique=True)
      slug = models.CharField(max_length=255, default='0')
      password = models.CharField(max_length=300)
      password_token = models.CharField(max_length=300, default='0')
      email = models.CharField(max_length=255, unique=True)
      email_verified = models.BooleanField(default=False)
      email_token = models.CharField(max_length=255)
      email_token_expiry = models.DateTimeField()
      tos = models.BooleanField(default=False)
      active = models.BooleanField(default=False)
      last_login = models.DateTimeField(auto_now_add=True)
      last_action = models.DateTimeField(auto_now_add=True)
      is_admin = models.BooleanField(default=False)
      role = models.CharField(max_length=255, default='0')
      created = models.DateTimeField(auto_now_add=True)
      modified = models.DateTimeField(auto_now_add=True)
  
      def __unicode__(self):
          return self.username
  
  class UsersModelForm(forms.ModelForm):
  
      def __init__(self, *args, **kwargs):
          super(UsersModelForm, self).__init__(*args, **kwargs)
          self.fields.keyOrder = ['username', 'email', 'password', 'passwordrepeat']
  
  
      passwordrepeat = forms.CharField(max_length=300, widget=forms.PasswordInput, label=u'Repeat Password')
  
      class Meta:
          model = Users
          fields = ('username', 'password', 'passwordrepeat', 'email')
          widgets = {
              'password' : forms.PasswordInput(),
          }
  
      def clean(self):
          cleaned_data = self.cleaned_data
          password = cleaned_data.get("password")
          passwordrepeat = cleaned_data.get("passwordrepeat")
          if password != passwordrepeat:
              raise forms.ValidationError("Passwords must match.")
  
          return cleaned_data
  </code></pre>