Merge branch 'master' of github.com:Gluejar/regluit
commit
ffcea5c3d6
|
@ -13,6 +13,9 @@
|
||||||
{% endfor %}</ul>{% endif %}
|
{% endfor %}</ul>{% endif %}
|
||||||
<br />{{ wishlists.today.count }} of them have 1 or more items on a wishlist.
|
<br />{{ wishlists.today.count }} of them have 1 or more items on a wishlist.
|
||||||
</li>
|
</li>
|
||||||
|
<li>{{ users.yesterday.count }} registered yesterday.
|
||||||
|
<br />{{ wishlists.yesterday.count }} of them have 1 or more items on a wishlist.
|
||||||
|
</li>
|
||||||
<li>{{ users.days7.count }} have registered in the past 7 days.
|
<li>{{ users.days7.count }} have registered in the past 7 days.
|
||||||
<br />{{ wishlists.days7.count }} of them have 1 or more items on a wishlist.
|
<br />{{ wishlists.days7.count }} of them have 1 or more items on a wishlist.
|
||||||
</li>
|
</li>
|
||||||
|
@ -23,6 +26,12 @@
|
||||||
<br />{{ wishlists.all.count }} of them have 1 or more items on a wishlist.
|
<br />{{ wishlists.all.count }} of them have 1 or more items on a wishlist.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li> {{ users.gr.count }} ungluers are connected to GoodReads.</li>
|
||||||
|
<li> {{ users.lt.count }} ungluers are connected to LibraryThing.</li>
|
||||||
|
<li> {{ users.fb.count }} ungluers are connected to FaceBook.</li>
|
||||||
|
<li> {{ users.tw.count }} ungluers are connected to Twitter.</li>
|
||||||
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<h2>Works</h2>
|
<h2>Works</h2>
|
||||||
|
@ -35,6 +44,8 @@
|
||||||
<li><a href="{% url work work.id %}">{{work.title}}</a></li>
|
<li><a href="{% url work work.id %}">{{work.title}}</a></li>
|
||||||
{% endfor %}</ul>{% endif %}
|
{% endfor %}</ul>{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
<li>{{ works.yesterday.count }} were added yesterday.
|
||||||
|
</li>
|
||||||
<li>{{ works.days7.count }} have been added in the past 7 days.
|
<li>{{ works.days7.count }} have been added in the past 7 days.
|
||||||
</li>
|
</li>
|
||||||
<li>{{ works.month.count }} have been added in this month.
|
<li>{{ works.month.count }} have been added in this month.
|
||||||
|
@ -69,6 +80,8 @@
|
||||||
<li><a href="{% url work ebook.edition.work.id %}">{{ebook.edition.work.title}}</a></li>
|
<li><a href="{% url work ebook.edition.work.id %}">{{ebook.edition.work.title}}</a></li>
|
||||||
{% endfor %}</ul>{% endif %}
|
{% endfor %}</ul>{% endif %}
|
||||||
</li>
|
</li>
|
||||||
|
<li>{{ ebooks.yesterday.count }} were added yesterday.
|
||||||
|
</li>
|
||||||
<li>{{ ebooks.days7.count }} have been added in the past 7 days.
|
<li>{{ ebooks.days7.count }} have been added in the past 7 days.
|
||||||
</li>
|
</li>
|
||||||
<li>{{ ebooks.month.count }} have been added in this month.
|
<li>{{ ebooks.month.count }} have been added in this month.
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div class="welcomealternatives">
|
<div class="welcomealternatives">
|
||||||
Or you can <a href="{% url auth_password_reset %}">view your profile</a> — <a href="{% url work_list 'popular' %}">see the most wishlisted books</a> — <a href="/feedback/">send us feedback</a>
|
Or you can <a href="{{editurl}}">change your username</a> — <a href="{% url work_list 'popular' %}">see the most wishlisted books</a> — <a href="/feedback/">send us feedback</a>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ there's no tab for seeing ALL my books, only the filters! huh.
|
||||||
<li class="tabs3"><a href="#">Wishlisted</a></li>
|
<li class="tabs3"><a href="#">Wishlisted</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<span id="rss"><a href="feed" title="RSS feed of {{ supporter }}'s latest wishbooks" alt="RSS feed of {{ supporter }}'s latest wishbooks"><img src="/static/images/feedicons-standard/feed-icon-14x14.png"><span>Subscribe</span></a></span>
|
<span id="rss"><a href="feed" title="RSS feed of {{ supporter }}'s latest wishbooks" ><img src="/static/images/feedicons-standard/feed-icon-14x14.png" alt="RSS feed of {{ supporter }}'s latest wishbooks" /><span>Subscribe</span></a></span>
|
||||||
|
|
||||||
{% if not works %}
|
{% if not works %}
|
||||||
{% comment %}
|
{% comment %}
|
||||||
|
|
|
@ -228,7 +228,7 @@ class WorkListView(ListView):
|
||||||
if (facet == 'popular'):
|
if (facet == 'popular'):
|
||||||
return models.Work.objects.order_by('-num_wishes', 'id')
|
return models.Work.objects.order_by('-num_wishes', 'id')
|
||||||
elif (facet == 'recommended'):
|
elif (facet == 'recommended'):
|
||||||
return models.Work.objects.filter(wishlists__user=recommended_user)
|
return models.Work.objects.filter(wishlists__user=recommended_user).order_by('-num_wishes')
|
||||||
elif (facet == 'new'):
|
elif (facet == 'new'):
|
||||||
return models.Work.objects.filter(num_wishes__gt=0).order_by('-created', '-num_wishes' ,'id')
|
return models.Work.objects.filter(num_wishes__gt=0).order_by('-created', '-num_wishes' ,'id')
|
||||||
else:
|
else:
|
||||||
|
@ -240,8 +240,8 @@ class WorkListView(ListView):
|
||||||
context['ungluers'] = userlists.work_list_users(qs,5)
|
context['ungluers'] = userlists.work_list_users(qs,5)
|
||||||
context['facet'] =self.kwargs['facet']
|
context['facet'] =self.kwargs['facet']
|
||||||
context['works_unglued'] = qs.filter(editions__ebooks__isnull=False).distinct()
|
context['works_unglued'] = qs.filter(editions__ebooks__isnull=False).distinct()
|
||||||
context['works_active'] = qs.exclude(editions__ebooks__isnull=False).filter(Q(campaigns__status='ACTIVE') | Q(campaigns__status='SUCCESSFUL')).distinct().order_by('-campaigns__status', 'campaigns__deadline')
|
context['works_active'] = qs.exclude(editions__ebooks__isnull=False).filter(Q(campaigns__status='ACTIVE') | Q(campaigns__status='SUCCESSFUL')).distinct()
|
||||||
context['works_wished'] = qs.exclude(editions__ebooks__isnull=False).exclude(campaigns__status='ACTIVE').exclude(campaigns__status='SUCCESSFUL').distinct().order_by('-num_wishes')
|
context['works_wished'] = qs.exclude(editions__ebooks__isnull=False).exclude(campaigns__status='ACTIVE').exclude(campaigns__status='SUCCESSFUL').distinct()
|
||||||
|
|
||||||
context['activetab'] = "#3"
|
context['activetab'] = "#3"
|
||||||
|
|
||||||
|
@ -1017,11 +1017,23 @@ class InfoPageView(TemplateView):
|
||||||
users.days7 = users.filter(date_joined__range = (date_today()-timedelta(days=7), now()))
|
users.days7 = users.filter(date_joined__range = (date_today()-timedelta(days=7), now()))
|
||||||
users.year = users.filter(date_joined__year = date_today().year)
|
users.year = users.filter(date_joined__year = date_today().year)
|
||||||
users.month = users.year.filter(date_joined__month = date_today().month)
|
users.month = users.year.filter(date_joined__month = date_today().month)
|
||||||
|
if date_today().day==1:
|
||||||
|
users.yesterday = users.filter(date_joined__range = (date_today()-timedelta(days=1), date_today()))
|
||||||
|
else:
|
||||||
|
users.yesterday = users.month.filter(date_joined__day = date_today().day-1)
|
||||||
|
users.gr = users.filter(profile__goodreads_user_id__isnull = False)
|
||||||
|
users.lt = users.exclude(profile__librarything_id = '')
|
||||||
|
users.fb = users.filter(profile__facebook_id__isnull = False)
|
||||||
|
users.tw = users.exclude(profile__twitter_id = '')
|
||||||
works = models.Work.objects
|
works = models.Work.objects
|
||||||
works.today = works.filter(created__range = (date_today(), now()))
|
works.today = works.filter(created__range = (date_today(), now()))
|
||||||
works.days7 = works.filter(created__range = (date_today()-timedelta(days=7), now()))
|
works.days7 = works.filter(created__range = (date_today()-timedelta(days=7), now()))
|
||||||
works.year = works.filter(created__year = date_today().year)
|
works.year = works.filter(created__year = date_today().year)
|
||||||
works.month = works.year.filter(created__month = date_today().month)
|
works.month = works.year.filter(created__month = date_today().month)
|
||||||
|
if date_today().day==1:
|
||||||
|
works.yesterday = works.filter(created__range = (date_today()-timedelta(days=1), date_today()))
|
||||||
|
else:
|
||||||
|
works.yesterday = works.month.filter(created__day = date_today().day-1)
|
||||||
works.wishedby2 = works.filter(num_wishes__gte = 2)
|
works.wishedby2 = works.filter(num_wishes__gte = 2)
|
||||||
works.wishedby20 = works.filter(num_wishes__gte = 20)
|
works.wishedby20 = works.filter(num_wishes__gte = 20)
|
||||||
works.wishedby5 = works.filter(num_wishes__gte = 5)
|
works.wishedby5 = works.filter(num_wishes__gte = 5)
|
||||||
|
@ -1033,11 +1045,19 @@ class InfoPageView(TemplateView):
|
||||||
ebooks.days7 = ebooks.filter(created__range = (date_today()-timedelta(days=7), now()))
|
ebooks.days7 = ebooks.filter(created__range = (date_today()-timedelta(days=7), now()))
|
||||||
ebooks.year = ebooks.filter(created__year = date_today().year)
|
ebooks.year = ebooks.filter(created__year = date_today().year)
|
||||||
ebooks.month = ebooks.year.filter(created__month = date_today().month)
|
ebooks.month = ebooks.year.filter(created__month = date_today().month)
|
||||||
|
if date_today().day==1:
|
||||||
|
ebooks.yesterday = ebooks.filter(created__range = (date_today()-timedelta(days=1), date_today()))
|
||||||
|
else:
|
||||||
|
ebooks.yesterday = ebooks.month.filter(created__day = date_today().day-1)
|
||||||
wishlists= models.Wishlist.objects.exclude(wishes__isnull=True)
|
wishlists= models.Wishlist.objects.exclude(wishes__isnull=True)
|
||||||
wishlists.today = wishlists.filter(created__range = (date_today(), now()))
|
wishlists.today = wishlists.filter(created__range = (date_today(), now()))
|
||||||
wishlists.days7 = wishlists.filter(created__range = (date_today()-timedelta(days=7), now()))
|
wishlists.days7 = wishlists.filter(created__range = (date_today()-timedelta(days=7), now()))
|
||||||
wishlists.year = wishlists.filter(created__year = date_today().year)
|
wishlists.year = wishlists.filter(created__year = date_today().year)
|
||||||
wishlists.month = wishlists.year.filter(created__month = date_today().month)
|
wishlists.month = wishlists.year.filter(created__month = date_today().month)
|
||||||
|
if date_today().day==1:
|
||||||
|
wishlists.yesterday = wishlists.filter(created__range = (date_today()-timedelta(days=1), date_today()))
|
||||||
|
else:
|
||||||
|
wishlists.yesterday = wishlists.month.filter(created__day = date_today().day-1)
|
||||||
return {
|
return {
|
||||||
'users': users,
|
'users': users,
|
||||||
'works': works,
|
'works': works,
|
||||||
|
|
|
@ -10,7 +10,10 @@ from django.db.models.query_utils import Q
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
|
|
||||||
import datetime
|
from datetime import timedelta
|
||||||
|
from regluit.utils.localdatetime import now, isoformat
|
||||||
|
import dateutil
|
||||||
|
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
import hashlib
|
import hashlib
|
||||||
import httplib
|
import httplib
|
||||||
|
@ -601,16 +604,16 @@ class Preapproval( PaypalEnvelopeRequest ):
|
||||||
cancel_url = settings.BASE_URL + CANCEL_URL
|
cancel_url = settings.BASE_URL + CANCEL_URL
|
||||||
|
|
||||||
# set the expiration date for the preapproval if not passed in
|
# set the expiration date for the preapproval if not passed in
|
||||||
now = datetime.datetime.utcnow()
|
now_val = now()
|
||||||
if expiry is None:
|
if expiry is None:
|
||||||
expiry = now + datetime.timedelta( days=settings.PREAPPROVAL_PERIOD )
|
expiry = now_val + timedelta( days=settings.PREAPPROVAL_PERIOD )
|
||||||
transaction.date_authorized = now
|
transaction.date_authorized = now_val
|
||||||
transaction.date_expired = expiry
|
transaction.date_expired = expiry
|
||||||
transaction.save()
|
transaction.save()
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
'endingDate': expiry.isoformat(),
|
'endingDate': isoformat(expiry),
|
||||||
'startingDate': now.isoformat(),
|
'startingDate': isoformat(now_val),
|
||||||
'maxTotalAmountOfAllPayments': '%.2f' % transaction.amount,
|
'maxTotalAmountOfAllPayments': '%.2f' % transaction.amount,
|
||||||
'maxNumberOfPayments':1,
|
'maxNumberOfPayments':1,
|
||||||
'maxAmountPerPayment': '%.2f' % transaction.amount,
|
'maxAmountPerPayment': '%.2f' % transaction.amount,
|
||||||
|
@ -704,8 +707,15 @@ class PreapprovalDetails(PaypalEnvelopeRequest):
|
||||||
else:
|
else:
|
||||||
self.approved = None
|
self.approved = None
|
||||||
|
|
||||||
self.expiration = self.response.get("endingDate", None)
|
try:
|
||||||
self.date = self.response.get("startingDate", None)
|
self.expiration = dateutil.parser.parse(self.response.get("endingDate"))
|
||||||
|
except:
|
||||||
|
self.expiration = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.date = dateutil.parser.parse(self.response.get("startingDate", None))
|
||||||
|
except:
|
||||||
|
self.date = None
|
||||||
|
|
||||||
except:
|
except:
|
||||||
self.errorMessage = "Error: ServerError"
|
self.errorMessage = "Error: ServerError"
|
||||||
|
|
|
@ -23,6 +23,7 @@ import logging
|
||||||
import os
|
import os
|
||||||
from decimal import Decimal as D
|
from decimal import Decimal as D
|
||||||
from regluit.utils.localdatetime import now
|
from regluit.utils.localdatetime import now
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
def setup_selenium():
|
def setup_selenium():
|
||||||
# Set the display window for our xvfb
|
# Set the display window for our xvfb
|
||||||
|
@ -278,7 +279,7 @@ class TransactionTest(TestCase):
|
||||||
|
|
||||||
w = Work()
|
w = Work()
|
||||||
w.save()
|
w.save()
|
||||||
c = Campaign(target=D('1000.00'),deadline=now() + datetime.timedelta(days=180),work=w)
|
c = Campaign(target=D('1000.00'),deadline=now() + timedelta(days=180),work=w)
|
||||||
c.save()
|
c.save()
|
||||||
|
|
||||||
t = Transaction()
|
t = Transaction()
|
||||||
|
|
|
@ -110,6 +110,15 @@ def make_naive(value, timezone):
|
||||||
value = timezone.normalize(value)
|
value = timezone.normalize(value)
|
||||||
return value.replace(tzinfo=None)
|
return value.replace(tzinfo=None)
|
||||||
|
|
||||||
|
def isoformat(value):
|
||||||
|
"""
|
||||||
|
if value is naive, assume it's in the default_timezone
|
||||||
|
"""
|
||||||
|
if is_naive(value):
|
||||||
|
return make_aware(value, get_default_timezone()).isoformat()
|
||||||
|
else:
|
||||||
|
return value.isoformat()
|
||||||
|
|
||||||
def as_utc_naive(value):
|
def as_utc_naive(value):
|
||||||
"""
|
"""
|
||||||
if value is naive, assume it's in the default time zone, then convert to UTC but make naive
|
if value is naive, assume it's in the default time zone, then convert to UTC but make naive
|
||||||
|
|
Loading…
Reference in New Issue