blob: 8bd01e3f40bdb88b9aaa944fd38935706fa5a8f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
from django.views.generic import DetailView, ListView
from django.views.generic.base import TemplateView
from .models import Deal, MyDeal, REIDeal
class DealDetailView(DetailView):
model = Deal
class MyDealListView(ListView):
model = MyDeal
queryset = MyDeal.objects.filter(added=False)
class MyDealLapListView(ListView):
model = MyDeal
queryset = MyDeal.objects.filter(asin="newbest")
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
|