コード例 #1
0
ファイル: views.py プロジェクト: mathuin/pyment
def index(request, template_name='meadery/index.html'):
    page_title = SITE_NAME
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    return render(request, template_name, locals())
コード例 #2
0
ファイル: views.py プロジェクト: dragonII/ecomstore
def index(request, template_name="catalog/index.html"):
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    page_title = 'Musical Instruments and Sheet Music for Musicians'
    return render_to_response(template_name, locals(), context_instance=RequestContext(request))
コード例 #3
0
ファイル: views.py プロジェクト: mathuin/pyment
def index(request, template_name="meadery/index.html"):
    page_title = SITE_NAME
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    return render(request, template_name, locals())
コード例 #4
0
def index(request, template_name='catalog/index.html'):
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    page_title = 'Online Grocery Shopping - Buy Fruits, Vegetables, Groceries and More | Speedkart'
    return render(request, template_name, locals())
コード例 #5
0
def index(request, template_name="catalog/index.html"):
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:settings.PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)

    page_title = 'Musical Instruments and Sheet Music for Musicians'

    return render(request, template_name, locals())
コード例 #6
0
ファイル: views.py プロジェクト: JesseWoods/spirit_buzz
def index(request, template_name="spiritbuzz/index.html"):

    page_title = 'Small Batch, Artisanal, and Expressive Spirits'
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)

    return render_to_response(template_name, locals(), context_instance=RequestContext(request))
コード例 #7
0
ファイル: views.py プロジェクト: ssssergey/Ladoshki
def index(request, template_name="catalog/index.html"):
    page_title = u'Ладошки'
    new_products = Product.active.all()
    new_products = [i for i in new_products if i.new()][0:PRODUCTS_PER_ROW]
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    return render_to_response(template_name, locals(), context_instance=RequestContext(request))
コード例 #8
0
ファイル: views.py プロジェクト: hansfree-git/onlineteeshop
def index(request, template_name='catalog/index.html'):
    """ site home page"""
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)

    page_title = 'Welcome to Teeshop| Retail store for all kinds of clothing for your need'

    return render(request, template_name, locals())
コード例 #9
0
def index(request, template_name="catalog/index.html"):
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    page_title = 'Musical Instruments and Sheet Music for Musicians'
    # locals() it returns a dictioanary of local variables if you have local variables
    return render_to_response(template_name,
                              locals(),
                              context_instance=RequestContext(request))
コード例 #10
0
def product_list(request):
    page_title = 'Decor Products'
    search_recs = stats.recommended_from_search(request)
    # default object manager
    # products = Product.objects.filter(is_active=True)
    # customized actve manager
    new_arrivals = Product.objects.filter(is_new=True)
    products = Product.active.all()
    bestseller = Product.objects.filter(is_bestseller=True)
    featured = Product.featured.all()[0:settings.PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    return render(request, 'product/list.html', {'products': products, 'bestseller': bestseller, 'featured': featured, 'search_recs': search_recs, 'new': new_arrivals})
コード例 #11
0
def index(request, template_name="catalog/index.html"):
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)
    all_view_recs = stats.recommended_from_all_views(request)
    print(search_recs)
    page_title = 'Musical Instruments and Sheet Music for Musicians'
    context = {
        'page_title': page_title,
    }
    # context2 = RequestContext(request, context)
    request.session.set_test_cookie()
    return render(request, template_name, locals(), RequestContext(request))
コード例 #12
0
 def get(self, request, *args, **kwargs):
     search_recommendations = stats.recommended_from_search(self.request)
     latest = Item.objects.all()[:5]
     carousels = Collection.objects.carousels()[:5]
     collections = Collection.objects.collections()[:2]
     promos = Collection.objects.promos()[:10]
     recently_viewed = stats.get_recently_viewed(self.request)[:6]
     context = {
         "carousels": carousels,
         "collections": collections,
         "promos": promos,
         "latest": latest,
         "recently_viewed": recently_viewed,
         "search_recommendations": search_recommendations
     }
     return render(self.request, "products/index.html", context)
コード例 #13
0
ファイル: views.py プロジェクト: Pythonian/ecomstore
def index(request):
    """ site home page """
    search_recs = stats.recommended_from_search(request)
    featured = Product.featured.all()[0:4]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)

    template = 'catalog/index.html'
    context = {
        'search_recs': search_recs,
        'featured': featured,
        'recently_viewed': recently_viewed,
        'view_recs': view_recs,
    }

    return render(request, template, context)
コード例 #14
0
ファイル: views.py プロジェクト: rizwanoffice/books
def index(request):
    search_recs = stats.recommended_from_search(request)

    featured = Product.featured.all()[0:settings.PRODUCTS_PER_ROW]
    recently_viewed = stats.get_recently_viewed(request)
    view_recs = stats.recommended_from_views(request)

    page_title = 'books'
    template = 'catalog/index.html'
    context = {
        'page_title': page_title,
        'search_recs': search_recs,
        'view_recs': view_recs,
        'featured': featured,
        'recently_viewed': recently_viewed,
    }
    return render(request, template, context)
コード例 #15
0
ファイル: context_processors.py プロジェクト: Dogechi/Me2U
def me2u(request):
    context = {
        'active_departments': Department.objects.filter(is_active=True),
        'reviews': ProductReview.objects.all().order_by('-date'),
        'brands': Brand.objects.filter(is_active=True),
        'site_name': settings.SITE_NAME,
        'LOGIN_URL': settings.LOGIN_URL,
        'meta_keywords': settings.META_KEYWORDS,
        'meta_description': settings.META_DESCRIPTION,
        'request': request
    }

    if request.user.is_authenticated and request.user.is_seller:
        try:
            brand = Brand.objects.filter(profile=request.user)
            context.update({'user_brands': brand})
        except Exception:
            pass

    if request.user.is_authenticated:
        wish_list = WishList.objects.filter(user=request.user)

        if wish_list.exists():
            context.update({'wish_list': wish_list})

    try:
        session = request.session['tracking_id']
        if session:
            context.update(
                {'recently_viewed': stats.get_recently_viewed(request)})
    except KeyError:
        pass

    banners = Banner.objects.filter(active=True)
    try:
        context.update({
            'trends':
            banners.filter(is_trending=True).select_related('product'),
            'deals':
            banners.filter(is_deal=True).select_related('product')
        })
    except:
        pass
    return context