Wishlists

The wishlists app allows signed-in users to create one or more wishlists. A user can add a product to their wishlist from the product detail page and manage their lists in the account section.

The wishlists app is wired up as a subapp of Customer.

Note

Please note that currently only private wishlists are supported. The hooks and fields for public (as in general public) and shared (as in access via an obfuscated link) are there, but the UI hasn’t been designed yet.

Abstract models

class oscar.apps.wishlists.abstract_models.AbstractLine(*args, **kwargs)[source]

One entry in a wish list. Similar to order lines or basket lines.

title = None

Store the title in case product gets deleted

class oscar.apps.wishlists.abstract_models.AbstractWishList(*args, **kwargs)[source]

Represents a user’s wish lists of products.

A user can have multiple wish lists, move products between them, etc.

add(product)[source]

Add a product to this wishlist

key = None

This key acts as primary key and is used instead of an int to make it harder to guess

classmethod random_key(length=6)[source]

Get a unique random generated key based on SHA-1 and owner

Views

class oscar.apps.customer.wishlists.views.LineMixin[source]

Handles fetching both a wish list and a product Views using this mixin must be passed two keyword arguments:

  • key: The key of a wish list
  • line_pk: The primary key of the wish list line

or

  • product_pk: The primary key of the product
class oscar.apps.customer.wishlists.views.WishListAddProduct(**kwargs)[source]

Adds a product to a wish list.

  • If the user doesn’t already have a wishlist then it will be created for them.
  • If the product is already in the wish list, its quantity is increased.
class oscar.apps.customer.wishlists.views.WishListCreateView(**kwargs)[source]

Create a new wishlist

If a product ID is assed as a kwargs, then this product will be added to the wishlist.

model

alias of WishList

class oscar.apps.customer.wishlists.views.WishListCreateWithProductView(**kwargs)[source]

Create a wish list and immediately add a product to it

class oscar.apps.customer.wishlists.views.WishListDetailView(**kwargs)[source]

This view acts as a DetailView for a wish list and allows updating the quantities of products.

It is implemented as FormView because it’s easier to adapt a FormView to display a product then adapt a DetailView to handle form validation.