def purchase(request): profile_picture = display_picture.check_admin(request) context = { 'profile_picture': profile_picture, } return render(request, 'checkout.html/', context)
def wishlist(request): profile_picture = display_picture.check_admin(request) context = { 'profile_picture': profile_picture, } return render(request, 'your_wishlist.html/', context)
def returns(request): profile_picture = display_picture.check_admin(request) context = { 'profile_picture': profile_picture, } return render(request, 'returns.html/', context)
def address(request): profile_picture = display_picture.check_admin(request) context = { 'profile_picture': profile_picture, } return render(request, 'saved_address.html/', context)
def profile(request): profile_picture = display_picture.check_admin(request) check = User.objects.get(id=request.user.id) username = request.user.username name = 'Admin' gender = 'm' mobile = '' email = '' if check.is_superuser == False: details = user_detail.objects.get(user_id=request.user.id) username = request.user.username name = details.name gender = details.gender mobile = details.phone email = details.email context = { 'profile_picture': profile_picture, 'username': username, 'name': name, 'gender': gender, 'mobile': mobile, 'email': email, } return render(request, 'profile.html/', context)
def prod_detail(request, procode): # Profile Picture for Navbar profile_picture = display_picture.check_admin(request) # Product Details obj = get_object_or_404(product_upload, product_code=procode) img = obj.get_images item = Cart_items.objects.filter(user=request.user, product=obj) print(item.exists()) if item.exists(): already_added = True else: already_added = False # Add to Cart if request.method == 'GET': if 'add_to_cart' in request.GET: cart_item = Cart_items(user=request.user, product=obj, quantity=request.GET.get('quantity_to_add')) cart_item.save() return redirect(obj) context = { 'profile_picture': profile_picture, 'product': obj, 'images': img, 'main_image': img[0], 'already_added': already_added, } return render(request, 'product.html/', context)
def cart(request): profile_picture = display_picture.check_admin(request) obj = Cart_items.objects.filter(user=request.user) # print(obj) context = { 'profile_picture': profile_picture, 'object': obj, } return render(request, 'cart.html/', context)
def home(request): profile_picture = display_picture.check_admin(request) if request.method == 'GET': if 'search_bar' in request.GET: search_content = request.GET.get('search_bar') # search_products=[] # obj = product_upload.objects.all() # for product in obj: # if search_content in product.title: # search_products.append(product) return redirect('categories') context = { 'profile_picture': profile_picture, } return render(request, 'home.html', context)
def category(request): profile_picture = display_picture.check_admin(request) # Floating Cart Content obj = product_upload.objects.all() products = [] images = [] for product in obj: products.append(product) img = product.get_images images.append(img[0]) context = { 'profile_picture': profile_picture, 'products': products, 'images': images, } return render(request, 'categories.html/', context)