Misc fixes

This commit is contained in:
Tanner Collin 2020-01-21 05:00:45 +00:00
parent a3e14c434d
commit 3af9f51fb0
3 changed files with 8 additions and 3 deletions

View File

@ -89,8 +89,10 @@ def tally_membership_months(member, fake_date=None):
start_date = member.current_start_date
if not start_date: return False
txs = models.Transaction.objects.filter(member_id=member.id)
txs = txs.filter(date__gte=start_date)
txs = models.Transaction.objects.filter(
member_id=member.id,
date__gte=start_date,
)
total_months_agg = txs.aggregate(Sum('number_of_membership_months'))
total_months = total_months_agg['number_of_membership_months__sum'] or 0

View File

@ -107,13 +107,14 @@ class SearchViewSet(Base, Retrieve):
result_objects = [queryset.get(id=x) for x in result_ids]
queryset = result_objects
else:
elif self.action == 'create':
gen_search_strings() # update cache
queryset = queryset.order_by('-vetted_date')
return queryset
# 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):
try:
seq = int(request.data.get('seq', 0))

View File

@ -39,6 +39,8 @@ if DEBUG:
'api.spaceport.dns.t0.vc',
]
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# Application definition