Example #1
0
    def get(self, request):
        list_type = request.GET.get('list_type', '')
        public_box = get_public_box()
        if list_type == 'scenic':
            all_spots = Spots.objects.all().order_by('-add_times')

        elif list_type == 'active':
            all_spots = Active.objects.all().order_by('go_time')
        else:
            result = json.dumps({
                "status": "failed",
                "msg": "来源错误"
            },
                                ensure_ascii=False)
            return HttpResponse(result)

        return render(
            request, 'scenic_list.html', {
                'all_spots': all_spots,
                'culture': public_box.get('culture'),
                'specialty': public_box.get('specialty'),
                'food': public_box.get('food'),
                'life': public_box.get('life'),
                'now_type': 'scenic',
                'list_type': list_type,
            })
Example #2
0
 def get(self, request):
     all_spots = Spots.objects.all().order_by('-add_times')
     public_box = get_public_box()
     return render(request, 'scenic_list.html', {
         'all_spots': all_spots,
         'culture': public_box.get('culture'),
         'specialty': public_box.get('specialty'),
         'food': public_box.get('food'),
         'life': public_box.get('life'),
         'now_type': 'scenic',
     })
Example #3
0
 def get(self, request):
     all_pros = Product.objects.all().order_by('-add_time')
     pro_type = request.GET.get('pro_type', '')
     if pro_type:
         all_pros = all_pros.filter(pro_type=pro_type)
     public_box = get_public_box()
     return render(
         request, 'mall_list.html', {
             'all_pros': all_pros,
             'pro_type': pro_type,
             'now_type': 'shop',
             'culture': public_box.get('culture'),
             'specialty': public_box.get('specialty'),
             'food': public_box.get('food'),
             'life': public_box.get('life'),
         })