Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7078039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:29:51+00:00 2026-05-28T06:29:51+00:00

def confirmemail(request,token): user = Users.objects.get(email_token = token) if user: user.email_token = ” user.email_token_expiry =

  • 0
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))

I get error:

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']

email_token_expiry is a datetime field in mysql table.

How can i set the email_token_expiry to null or empty or to the right formated null/0/empty datetime?

It will be highly appreciated if someone help me to fix this problem.

models.py:

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:29:52+00:00Added an answer on May 28, 2026 at 6:29 am

    Specify email_token_expiry as @ArthurNeves suggests in models.py.

    email_token_expiry = models.DateTimeField(null=True, blank=True)
    

    Then when you set email_token_expiry it must be:

    user.email_token_expiry = None
    

    Not:

    user.email_token_expiry = ''
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

def self.get(server) return unless server server = server.to_s if klass = @handlers[server] obj =
Error: TypeError at /confirmemail/amlqctnhel/ confirmemail() takes exactly 2 arguments (1 given) Request Method: GET
views.py: def register(request): flag = True possible = '0123456789abcdefghijklmnopqrstuvwxyz' token = '' tempToken =
def display_home(request): from datetime import * now=datetime.today() print 'Month is %s'%now.month events=Event.objects.filter(e_date__year=datetime.today().year).filter(e_date__month=datetime.today().month,e_status=1).values('e_name','e_date') return render_to_response("SecureVirtualElection/home.html",{'events':
def register(request): flag = True possible = '0123456789abcdefghijklmnopqrstuvwxyz' token = '' current_datetime = datetime.datetime.now()
def register(request): flag = True possible = '0123456789abcdefghijklmnopqrstuvwxyz' token = '' length = 10
def register(request): flag = True possible = '0123456789abcdefghijklmnopqrstuvwxyz' token = '' length = 10
def test4(request): logging.debug(request) logging.debug(request.META['HTTP_REFERER']) return render_to_response('test2/test4.html', context_instance=RequestContext(request)) In the above code can request be
def process_event(request, eventID, eventData): return HttpResponse(process event!) @csrf_exempt @slip_protect def catch_event(request,eventID): if request.POST: process_event(request,eventID,
def foo (): x = re.compile('^abc') foo2(x) def foo2(x): How do I get x

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.