I'm using the ecommerce package Django-Oscar. In Oscar there is an object related to Basket called a "Line" that I do not understand. What is a Line, what information does it convey and what is it meant to represent?
问问题
354 次
2 回答
2
它是篮子里的一个项目:
int single word "BasketItem"
""" product and a quantity """
于 2015-12-14T11:59:03.787 回答
1
我使用 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)
于 2015-12-14T12:37:59.793 回答