Skip to content

Commit

Permalink
update orders app views
Browse files Browse the repository at this point in the history
  • Loading branch information
RustamovAkrom committed Oct 3, 2024
1 parent f4967aa commit 53bf944
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions apps/orders/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,24 @@ def order_create(request):
price=item["price"],
quantity=item["quantity"],
)
# clear the cart
cart.clear()
# Launch asynchronous task
order_created(order.id)
# set the order in the session
request.session["order_id"] = order.id
# redirect for payment
messages.success(request, "Successfully placed order")
return redirect("payment.process")
return redirect("payment:process")
messages.error(request, "Your field are not valid")

else:
form = OrderCreateForm()

def payment_confirmation(data):
Order.objects.filter(order_key=data).update(billing_status=True)
return render(request, "orders/order/create.html", {"cart": cart, "form": form})


def user_orders(request):
user_id = request.user.id
orders = Order.objects.filter(user=user_id).filter(billing_status=True)
return orders
@staff_member_required
def admin_order_detail(request, order_id):
order = get_object_or_404(Order, id=order_id)
return render(request, "admin/orders/order/detail.html", {"order": order})

0 comments on commit 53bf944

Please sign in to comment.