diff --git a/accounts/models.py b/accounts/models.py index 1bf69da..9887187 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -44,6 +44,7 @@ class UserProfile(models.Model): # User user = models.ForeignKey(User, unique=True) is_pro = models.BooleanField(default=False) + pro_date = models.DateTimeField(blank=True, null=True) stripe_id = models.CharField(max_length=100, null=True, blank=True) has_gravatar = models.BooleanField(default=False) list_view = models.CharField(max_length=1, null=False, blank=False,default='N', choices=LIST_VIEW_CHOICES) diff --git a/templates/base.html b/templates/base.html index 550546c..0c191d0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -427,6 +427,7 @@ user_hash: '{{ request.user.id|intercom_sha_256 }}', email: '{{ request.user.email }}', created_at: {{ request.user.date_joined|date:"U" }}, + pro_date: {% firstof request.user.profile.pro_date|date:"U" 'null' %}, custom_data: { 'snipts count': {% snipts_count_for_user %}, 'profile link': 'https://snipt.net/{{ request.user.username }}/', diff --git a/views.py b/views.py index 6ae4966..be6b355 100644 --- a/views.py +++ b/views.py @@ -12,6 +12,7 @@ from django.db.models import Count from snipts.models import Snipt from taggit.models import Tag +import datetime import hashlib import stripe @@ -116,6 +117,7 @@ def pro_complete(request): profile = request.user.profile profile.is_pro = True + profile.pro_date = datetime.datetime.now() profile.stripe_id = customer.id profile.save()