You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.py 587B

1234567891011121314
  1. from oscar.product.models import ItemClass, Item
  2. from oscar.stock.models import Partner, StockRecord
  3. def create_product(price=None):
  4. u"""
  5. Helper method for creating products that are used in
  6. tests.
  7. """
  8. ic,_ = ItemClass._default_manager.get_or_create(name="Dummy item class")
  9. item = Item._default_manager.create(title="Dummy product", item_class=ic)
  10. if price:
  11. partner,_ = Partner._default_manager.get_or_create(name="Dummy partner")
  12. sr = StockRecord._default_manager.create(product=item, partner=partner, price_excl_tax=price)
  13. return item