【问题标题】:In Oscar, what is a line?在奥斯卡,什么是台词?
【发布时间】:2015-05-27 00:51:15
【问题描述】:

我正在使用电子商务包 Django-Oscar。在奥斯卡有一个与篮子相关的对象,称为“线”,我不明白。什么是线,它传达什么信息,它代表什么?

【问题讨论】:

    标签: python django django-oscar


    【解决方案1】:

    这是篮子里的一件物品:

    int single word "BasketItem"
    """ product and a quantity """
    

    参考:https://github.com/django-oscar/django-oscar/blob/master/src/oscar/apps/basket/abstract_models.py#L564

    【讨论】:

      【解决方案2】:

      我使用 Django-Oscar 已经 2 年了。这是非常原始的包装。 一条线是篮子中的一条记录。 您可以在源模型 AbstractLine 中看到它。

      
      class AbstractLine(models.Model):
          """
          A line of a basket (product and a quantity)
          """
          basket = models.ForeignKey('basket.Basket', related_name='lines',
                                     verbose_name=_("Basket"))
      
      
      # This is to determine which products belong to the same line
      # We can't just use product.id as you can have customised products
      # which should be treated as separate lines.  Set as a
      # SlugField as it is included in the path for certain views.
      line_reference = models.SlugField(_("Line Reference"), max_length=128,
                                        db_index=True)
      
      product = models.ForeignKey(
          'catalogue.Product', related_name='basket_lines',
          verbose_name=_("Product"))
      quantity = models.PositiveIntegerField(_('Quantity'), default=1)
      
      # We store the unit price incl tax of the product when it is first added to
      # the basket.  This allows us to tell if a product has changed price since
      # a person first added it to their basket.
      price_excl_tax = models.DecimalField(
          _('Price excl. Tax'), decimal_places=2, max_digits=12,
          null=True)
      price_incl_tax = models.DecimalField(
          _('Price incl. Tax'), decimal_places=2, max_digits=12, null=True)
      # Track date of first addition
      date_created = models.DateTimeField(_("Date Created"), auto_now_add=True)
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-05-02
        • 2011-02-15
        • 2018-05-26
        • 1970-01-01
        • 2014-09-23
        • 1970-01-01
        相关资源
        最近更新 更多