diff options
author | adityacp | 2017-05-03 16:10:28 +0530 |
---|---|---|
committer | adityacp | 2017-05-03 16:10:28 +0530 |
commit | a76be3052276945d688ab8746679f25cd40cad3f (patch) | |
tree | 44c4309d1065e953d7f8f13f3b6ed3904d51dc8a /yaksh/forms.py | |
parent | 5cebef64ed9f3c164db964828a62c7e0a3bde290 (diff) | |
download | online_test-a76be3052276945d688ab8746679f25cd40cad3f.tar.gz online_test-a76be3052276945d688ab8746679f25cd40cad3f.tar.bz2 online_test-a76be3052276945d688ab8746679f25cd40cad3f.zip |
Change forms.py, views.py and urls.py
- Store activation key expiry time according to timezone for email verification and activation
- Add reverse resolution in urls.py
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 5dd56a2..3459be9 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -10,6 +10,7 @@ from taggit.managers import TaggableManager from taggit.forms import TagField from django.forms.models import inlineformset_factory from django.db.models import Q +from django.utils import timezone from textwrap import dedent try: from string import letters @@ -18,7 +19,7 @@ except ImportError: from string import punctuation, digits import datetime import pytz -from .email_verification import generate_activation_key +from .send_emails import generate_activation_key languages = ( ("select", "Select Language"), @@ -146,11 +147,8 @@ class UserRegisterForm(forms.Form): new_profile.is_email_verified = True else: new_profile.activation_key = generate_activation_key(new_user.username) - new_profile.key_expiry_time = datetime.datetime.strftime( - datetime.datetime.now() + \ - datetime.timedelta(minutes=20), - "%Y-%m-%d %H:%M:%S" - ) + new_profile.key_expiry_time = timezone.now() + \ + timezone.timedelta(minutes=20) new_profile.save() return u_name, pwd, new_user.email, new_profile.activation_key |