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

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

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

save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

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.

form_class

alias of oscar.apps.wishlists.forms.WishListForm

form_valid(form)[source]

If the form is valid, save the associated model.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

model

alias of oscar.apps.wishlists.models.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.WishListDeleteView(**kwargs)[source]
get_object(queryset=None)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

model

alias of oscar.apps.wishlists.models.WishList

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.

form_class

alias of django.forms.formsets.LineFormFormSet

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_context_data(**kwargs)[source]

Insert the form into the context dict.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

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

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

class oscar.apps.customer.wishlists.views.WishListMoveProductToAnotherWishList(**kwargs)[source]
class oscar.apps.customer.wishlists.views.WishListRemoveProduct(**kwargs)[source]
get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_object(queryset=None)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

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

alias of oscar.apps.wishlists.forms.WishListForm

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_object(queryset=None)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

get_success_url()[source]

Return the URL to redirect to after processing a valid form.

model

alias of oscar.apps.wishlists.models.WishList