【问题标题】:How can I get only the products that belong to a certain type added from the dashboar in django-oscar?如何仅从 django-oscar 的仪表板中获取属于特定类型的产品?
【发布时间】:2019-04-06 05:49:16
【问题描述】:

我想过滤属于某类产品的产品,并将它们显示在一个 html 文件中。产品类型是从 django-oscar 的默认管理面板中添加的。我在互联网上找到了 django-oscar-easyrec 软件包可能对此有所帮助的唯一解决方案,但它没有安装说明easyrec 需要低于 12 的版本。另一方面,任何低于 12 的版本都与 django-oscar 1.6.7 不兼容,因此我不能使用 easyrec。所以我正在寻找这个包的替代解决方案来实现结果。我是 django-oscar 的新手,我发现他们的文档很难理解。

【问题讨论】:

    标签: django-oscar


    【解决方案1】:

    您可以使用目录类别获得相同类型的产品

     recommend_products = Product.objects.active().filter(
                    categories=product.categories.all()[0],
                ).exclude(pk=product.pk)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-28
      • 2021-08-05
      • 1970-01-01
      • 2015-02-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多