summaryrefslogtreecommitdiff
path: root/app/trading/views.py
diff options
context:
space:
mode:
authorlxf <sng@luxagraf.net>2022-02-18 11:51:48 -0500
committerlxf <sng@luxagraf.net>2022-02-18 11:51:48 -0500
commit82f01f5f10190bcb70cb5357ec4bac542b7c197a (patch)
tree149dcfe97933a11a6b8f2255460d7fb4b88f83e2 /app/trading/views.py
parent2f3dc944de7e28594924fdcc66ac7ca6dd4a6686 (diff)
trad: fixed some bugs in list view
Diffstat (limited to 'app/trading/views.py')
-rw-r--r--app/trading/views.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/trading/views.py b/app/trading/views.py
index 432e21d..62f0dd5 100644
--- a/app/trading/views.py
+++ b/app/trading/views.py
@@ -1,4 +1,4 @@
-from datetime import datetime
+import datetime
from django.http import HttpResponseRedirect
from django.utils import timezone
from django.views.generic.edit import CreateView, UpdateView
@@ -25,16 +25,17 @@ class LuxTradeListView(PaginatedListView):
#context['options_year_pl'] = LuxOptionsTrade.stats.get_year_pl()
context['options_monthly_pl'] = LuxOptionPurchase.stats.get_month_pl()
context['options_year_pl'] = LuxOptionPurchase.stats.get_year_pl()
- context['month'] = datetime.now().strftime('%h')
+ context['month'] = timezone.now().strftime('%h')
context['luxoptions_purchases'] = LuxOptionPurchase.objects.all()
return context
def get_queryset(self):
queryset = super(LuxTradeListView, self).get_queryset()
queryset = queryset.filter(status=1)
- start_date = datetime.date(timezone.now().year, 1, 1)
- end_date = datetime.date(timezone.now().year, 12, 31)
- return self.filter(close_date__range=(start_date, end_date))
+ year=timezone.now().year
+ start_date = datetime.date(year, 1, 1)
+ end_date = datetime.date(year, 12, 31)
+ return queryset.filter(close_date__range=(start_date, end_date))
class LuxTradeDetailView(UpdateView):