Misc fixes
This commit is contained in:
parent
a3e14c434d
commit
3af9f51fb0
|
@ -89,8 +89,10 @@ def tally_membership_months(member, fake_date=None):
|
||||||
start_date = member.current_start_date
|
start_date = member.current_start_date
|
||||||
if not start_date: return False
|
if not start_date: return False
|
||||||
|
|
||||||
txs = models.Transaction.objects.filter(member_id=member.id)
|
txs = models.Transaction.objects.filter(
|
||||||
txs = txs.filter(date__gte=start_date)
|
member_id=member.id,
|
||||||
|
date__gte=start_date,
|
||||||
|
)
|
||||||
total_months_agg = txs.aggregate(Sum('number_of_membership_months'))
|
total_months_agg = txs.aggregate(Sum('number_of_membership_months'))
|
||||||
total_months = total_months_agg['number_of_membership_months__sum'] or 0
|
total_months = total_months_agg['number_of_membership_months__sum'] or 0
|
||||||
|
|
||||||
|
|
|
@ -107,13 +107,14 @@ class SearchViewSet(Base, Retrieve):
|
||||||
result_objects = [queryset.get(id=x) for x in result_ids]
|
result_objects = [queryset.get(id=x) for x in result_ids]
|
||||||
|
|
||||||
queryset = result_objects
|
queryset = result_objects
|
||||||
else:
|
elif self.action == 'create':
|
||||||
gen_search_strings() # update cache
|
gen_search_strings() # update cache
|
||||||
queryset = queryset.order_by('-vetted_date')
|
queryset = queryset.order_by('-vetted_date')
|
||||||
|
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
# must POST so query string doesn't change so preflight request is cached
|
# must POST so query string doesn't change so preflight request is cached
|
||||||
|
# to save an OPTIONS request so search is fast
|
||||||
def create(self, request):
|
def create(self, request):
|
||||||
try:
|
try:
|
||||||
seq = int(request.data.get('seq', 0))
|
seq = int(request.data.get('seq', 0))
|
||||||
|
|
|
@ -39,6 +39,8 @@ if DEBUG:
|
||||||
'api.spaceport.dns.t0.vc',
|
'api.spaceport.dns.t0.vc',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user