Exemplo n.º 1
0
def log_product_view(request, product):
    t_id = tracking_id(request)
    try:
        v = ProductView.objects.get(tracking_id=t_id, product=product)
        v.save()
    except ProductView.DoesNotExist:
        v = ProductView()
        v.product = product
        v.tracking_id = t_id
        v.ip_address = request.META.get('REMOTE_ADDR')
        v.user = None
        if request.user.is_authenticated():
            v.user = request.user
        v.save()
Exemplo n.º 2
0
def log_product_view(request, product):
    t_id = tracking_id(request)
    try:
        v = ProductView.objects.get(tracking_id=t_id, product=product)
        v.save()
    except ProductView.DoesNotExist:
        v = ProductView()
        v.product = product
        v.ip_address = request.META.get('REMOTE_ADDR')
        v.tracking_id = t_id
        v.user = None
        if request.user.is_authenticated:
            v.user = request.user
        v.save()
Exemplo n.º 3
0
def log_product_view(request,product):
    t=tracking_id(request)
    try:
        v=ProductView.objects.get(tracking_id=t,product=product)
        v.save()
    except ProductView.DoesNotExist:
        v=ProductView()
        v.product=product
        v.ip_address=search.get_client_ip(request)
        v.tracking_id=t
        v.user=None
        if request.user.is_authenticated():
            v.user=request.user
        v.save()
Exemplo n.º 4
0
def log_product_view(request, product):
    """ log the current customer as having viewed the given product instance """
    t_id = tracking_id(request)
    try:
        v = ProductView.objects.get(tracking_id=t_id, product=product)
        v.save()
    except ProductView.DoesNotExist:
        v = ProductView()
        v.product = product
        v.ip_address = request.META.get('REMOTE_ADDR')
        if not request.META.get('REMOTE_ADDR'):
            v.ip_address = '127.0.0.1'
        v.user = None
        v.tracking_id = t_id
        if request.user.is_authenticated:
            v.user = request.user
        v.save()
Exemplo n.º 5
0
def log_product_view(request, product):
    """ log the current customer as having viewed the given product instance """
    t_id = tracking_id(request)
    try:
        v = ProductView.objects.get(tracking_id=t_id, product=product)
        v.save()
    except ProductView.DoesNotExist:
        v = ProductView()
        v.product = product
        v.ip_address = request.META.get("REMOTE_ADDR")
        if not request.META.get("REMOTE_ADDR"):
            v.ip_address = "127.0.0.1"
        v.user = None
        v.tracking_id = t_id
        if request.user.is_authenticated():
            v.user = request.user
        v.save()