Django: Vendor Dashboard Not Displaying All Orders for Products Sold

I’m working on a Django project where I have a vendor dashboard that should display all orders for the products uploaded by the current vendor. However, the dashboard is only showing orders placed by one user and not orders placed by other users for the same products.

Models:
Here are the relevant models:

class Product(models.Model):
    pid=ShortUUIDField(length=10,max_length=100,prefix="prd",alphabet="abcdef")


    user=models.ForeignKey(CustomUser, on_delete=models.SET_NULL ,null=True)
    cagtegory=models.ForeignKey(Category, on_delete=models.SET_NULL ,null=True,related_name="category")
    vendor=models.ForeignKey(Vendor, on_delete=models.SET_NULL,null=True,related_name="product")
    color=models.ManyToManyField(Color,blank=True)
    size=models.ManyToManyField(Size,blank=True)


    title=models.CharField(max_length=100,default="Apple")
    image=models.ImageField(upload_to=user_directory_path,default="product.jpg")
    description=RichTextUploadingField(null=True, blank=True,default="This is a product")

    price = models.DecimalField(max_digits=10, decimal_places=2, default=1.99)
    old_price = models.DecimalField(max_digits=10, decimal_places=2, default=2.99)

    specifications=RichTextUploadingField(null=True, blank=True)


    tags=TaggableManager(blank=True)

    product_status=models.CharField(choices=STATUS, max_length=10,default="In_review")


    status=models.BooleanField(default=True)
    in_stock=models.BooleanField(default=True)
    featured=models.BooleanField(default=False)
    digital=models.BooleanField(default=False)

    sku=ShortUUIDField(length=10,max_length=100,prefix="sku",alphabet="abcdef")

    date=models.DateTimeField(auto_now_add=True)
    updated=models.DateTimeField(null=True,blank=True)

    class Meta:
        verbose_name_plural="Products"

    def product_image(self):
        return mark_safe('<img src="%s" width="50" height="50"/>'%(self.image.url))

    def __str__(self):
        return self.title
    def get_percentage(self):
        new_price=((self.old_price-self.price)/self.old_price)*100
        return new_price

    def get_product_price_by_size(self , Size):
        return self.price + Size.objects.get(name = Size).price


class CartOrder(models.Model):
    user=models.ForeignKey(CustomUser,on_delete=models.CASCADE)
    item=models.CharField(max_length=100)
    price= models.DecimalField(max_digits=10, decimal_places=2,default="1.99")
    paid_status=models.BooleanField(default=False)
    order_date=models.DateTimeField(auto_now_add=True)
    product_status=models.CharField(choices=STATUS_CHOICE, max_length=30,default="processing")

    class Meta:
        verbose_name_plural="Cart Order"

class CartOrderItems(models.Model):
    user = models.ForeignKey(CustomUser, on_delete=models.CASCADE)
    vendor = models.ForeignKey(Vendor,on_delete=models.CASCADE,default=1) #I have to fix the default
    order=models.ForeignKey(CartOrder,on_delete=models.CASCADE,related_name="cartorderitems")
    # product = models.ForeignKey(Product, on_delete=models.CASCADE, default=1)
    invoice_num = models.BigIntegerField(blank=True,null=True)
    product_status=models.CharField(max_length=200)
    item=models.CharField(max_length=100)
    image=models.CharField(max_length=100)
    qty=models.BigIntegerField(default=0)
    price= models.DecimalField(max_digits=12, decimal_places=2,default="15")
    total= models.DecimalField(max_digits=12, decimal_places=2,default="20")
    color=models.ForeignKey(Color,on_delete=models.SET_NULL,null=True,blank=True)
    size=models.ForeignKey(Size,on_delete=models.SET_NULL,null=True,blank=True)



    class Meta:
        verbose_name_plural="Cart Order Items"

    def catagory_image(self):
        return mark_safe('<img src="%s" width="50" height="50"/>'%(self.image.url))
        
    def oder_img(self):
        return mark_safe('<img src="/media/%s" width="50" height="50"/>'%(self.image))

View:
Here is the view that is supposed to fetch and display the orders:

@login_required
def vendor_pannel1(request):
    # Get products uploaded by the current vendor (user)
    vendor_products = Product.objects.filter(user=request.user)
    print("Vendor Products:", vendor_products)

    # Get CartOrderItems related to those products
    order_items = CartOrderItems.objects.filter(invoice_num__in=vendor_products)
    # print("Order Items:", order_items)

    # Get orders related to those CartOrderItems
    orders = CartOrder.objects.filter(cartorderitems__in=order_items).distinct()
    print("Orders:", orders)

    context = {
        "orders": orders,
    }
    return render(request, "vendorpannel/dashboard.html", context)

Issue:
When I place an order as one user, it shows up in the dashboard. However, when another user places an order for the same product, it does not appear in the dashboard.

What I’ve Tried:
Verified that the vendor_products queryset is returning the correct products.
Verified that the order_items queryset contains the correct order items.
Used .distinct() to ensure no duplicate orders.

Expected Behavior:
I expect the dashboard to display all orders related to the products uploaded by the current vendor, regardless of which user placed the order.

Actual Behavior:
The dashboard only shows orders from one user and does not display orders from other users for the same products.

Any insights or suggestions on why this might be happening and how to resolve it would be greatly appreciated!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật