def insert()

in django_app/logistics/orders.py [0:0]


def insert(request):
  order_uuid=uuid.uuid1()
  order_created_at=timezone.now()
  order_updated_at=timezone.now()
  order_product=uuid.uuid1()
  order_merchant_id=Merchant.objects.get(id=randrange(2,Merchant.objects.all().aggregate(Max('id'))['id__max'])).id
  order_customer_id=Customer.objects.get(id=randrange(2,Customer.objects.all().aggregate(Max('id'))['id__max'])).id
  order_obj=Order(uuid=order_uuid,created_at=order_created_at,updated_at=order_updated_at,product=order_product,customer_id=order_customer_id,merchant_id=order_merchant_id)
  order_obj.save()
  context = {
      "order": order_obj,
  }

  return render(request, "order_detail.html", context)