Promotions

Promotions are small blocks of content that can link through to other parts of this site. Examples include:

  • A banner image shown on at the top of the homepage that links through to a new offer page
  • A “pod” image shown in the right-hand sidebar of a page, linking through to newly merchandised page.
  • A biography of an author (featuring an image and a block of HTML) shown at the top of the search results page when the search query includes the author’s surname.

These are modeled using a base promotion model, which contains image fields, the link destination, and two “linking” models which link promotions to either a page URL or a particular keyword.

Models

class oscar.apps.promotions.models.AbstractProductList(*args, **kwargs)[source]

Abstract superclass for promotions which are essentially a list of products.

class oscar.apps.promotions.models.AbstractPromotion(*args, **kwargs)[source]

Abstract base promotion that defines the interface that subclasses must implement.

template_name()[source]

Returns the template to use to render this promotion.

class oscar.apps.promotions.models.AutomaticProductList(id, name, description, link_url, link_text, date_created, method, num_products)[source]
exception DoesNotExist
exception MultipleObjectsReturned
class oscar.apps.promotions.models.HandPickedProductList(*args, **kwargs)[source]

A hand-picked product list is a list of manually selected products.

exception DoesNotExist
exception MultipleObjectsReturned
class oscar.apps.promotions.models.Image(*args, **kwargs)[source]

An image promotion is simply a named image which has an optional link to another part of the site (or another site).

This can be used to model both banners and pods.

exception DoesNotExist
exception MultipleObjectsReturned
class oscar.apps.promotions.models.KeywordPromotion(*args, **kwargs)[source]

A promotion linked to a specific keyword.

This can be used on a search results page to show promotions linked to a particular keyword.

exception DoesNotExist
exception MultipleObjectsReturned
class oscar.apps.promotions.models.MultiImage(*args, **kwargs)[source]

A multi-image promotion is simply a collection of image promotions that are rendered in a specific way. This models things like rotating banners.

exception DoesNotExist
exception MultipleObjectsReturned
class oscar.apps.promotions.models.OrderedProduct(id, list, product, display_order)[source]
exception DoesNotExist
exception MultipleObjectsReturned
class oscar.apps.promotions.models.OrderedProductList(id, name, description, link_url, link_text, date_created, handpickedproductlist_ptr, tabbed_block, display_order)[source]
exception DoesNotExist
exception MultipleObjectsReturned
class oscar.apps.promotions.models.PagePromotion(*args, **kwargs)[source]

A promotion embedded on a particular page.

exception DoesNotExist
exception MultipleObjectsReturned
class oscar.apps.promotions.models.RawHTML(*args, **kwargs)[source]

Simple promotion - just raw HTML

exception DoesNotExist
exception MultipleObjectsReturned
class oscar.apps.promotions.models.SingleProduct(id, name, product, description, date_created)[source]
exception DoesNotExist
exception MultipleObjectsReturned
class oscar.apps.promotions.models.TabbedBlock(id, name, date_created)[source]
exception DoesNotExist
exception MultipleObjectsReturned

Views

class oscar.apps.promotions.views.HomeView(**kwargs)[source]

This is the home page and will typically live at /

class oscar.apps.promotions.views.RecordClickView(**kwargs)[source]

Simple RedirectView that helps recording clicks made on promotions

get_redirect_url(**kwargs)[source]

Return the URL redirect to. Keyword arguments from the URL pattern match generating the redirect request are provided as kwargs to this method.