+ 2

Show Orderitems based on Order Id.

I doing an ecommerce django website project. I have created six models Category, Product, Customer, Order, OrderItems and OrderSummary. When each time a new customer order items, OrderItems object are created in admin page. My problem here is Object OrderItems is created on each items that customer choose regardless of Order Id, I.e, when a customer choose more than one item at time that much object where created. I need to get single OrderItems object of a particular order id that have morethan one item that customer ordered. What can I do? Or is there is any possibility to filter an Order items based on a order Id that can be done within that model.py or Admin.py file? Plz help?

20th Aug 2020, 2:06 PM
Lukmanul Hakeem M
Lukmanul Hakeem M - avatar
4 Antworten
+ 3
Can you please provide any learnig link to let me know how to query and run analysis 😊
21st Aug 2020, 4:34 AM
Lukmanul Hakeem M
Lukmanul Hakeem M - avatar
+ 2
Okay
21st Aug 2020, 9:41 AM
Lukmanul Hakeem M
Lukmanul Hakeem M - avatar
+ 1
Yah...using sqlite I am little bit beginner, and my first attempt to do a project
21st Aug 2020, 4:30 AM
Lukmanul Hakeem M
Lukmanul Hakeem M - avatar
+ 1
To work this out you have to create a model called Order and pass it as ForeignKey to another model that should be item. Like This 👇 https://code.sololearn.com/cMh04t3g5sj3/?ref=app
9th Sep 2020, 4:44 AM
AJAY LINGAYAT
AJAY LINGAYAT - avatar