diff options
Diffstat (limited to 'app/trading/views.py')
-rw-r--r-- | app/trading/views.py | 11 |
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): |