diff options
Diffstat (limited to 'app/deals/views.py')
-rw-r--r-- | app/deals/views.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/deals/views.py b/app/deals/views.py index bf0a4c8..8bd01e3 100644 --- a/app/deals/views.py +++ b/app/deals/views.py @@ -1,7 +1,7 @@ from django.views.generic import DetailView, ListView from django.views.generic.base import TemplateView -from .models import Deal, MyDeal +from .models import Deal, MyDeal, REIDeal class DealDetailView(DetailView): @@ -9,6 +9,7 @@ class DealDetailView(DetailView): class MyDealListView(ListView): model = MyDeal + queryset = MyDeal.objects.filter(added=False) class MyDealLapListView(ListView): model = MyDeal @@ -17,3 +18,13 @@ class MyDealLapListView(ListView): class GenerateDealCodeView(TemplateView): template_name = "deals/deal_code.html" + + +class REIDealListView(ListView): + model = REIDeal + queryset = REIDeal.objects.filter(generate_deal=True).order_by("category") + + def get_context_data(self, **kwargs): + context = super(REIDealListView, self).get_context_data(**kwargs) + context['deals_count'] = REIDeal.objects.filter(generate_deal=True).count() + return context |