Shuup
v. latest
  • shuup.front.apps.carousel package
    • Subpackages
    • Submodules
    • shuup.front.apps.carousel.apps module
    • shuup.front.apps.carousel.forms module
    • shuup.front.apps.carousel.models module
    • shuup.front.apps.carousel.plugins module
    • Module contents
Shuup
  • Docs »
  • shuup.front.apps.carousel package
  • Edit on GitHub

shuup.front.apps.carousel package¶

Subpackages¶

  • shuup.front.apps.carousel.admin_module package
    • Subpackages
      • shuup.front.apps.carousel.admin_module.views package
        • Module contents
    • Submodules
    • shuup.front.apps.carousel.admin_module.forms module
    • Module contents

Submodules¶

shuup.front.apps.carousel.apps module¶

class shuup.front.apps.carousel.apps.AppConfig(*args, **kwargs)[source]¶

Bases: shuup.apps.AppConfig

name = 'shuup.front.apps.carousel'¶
label = 'carousel'¶
provides = {'admin_module': ['shuup.front.apps.carousel.admin_module:CarouselModule'], 'xtheme_plugin': ['shuup.front.apps.carousel.plugins:CarouselPlugin', 'shuup.front.apps.carousel.plugins:BannerBoxPlugin']}¶
ready()[source]¶

shuup.front.apps.carousel.forms module¶

class shuup.front.apps.carousel.forms.CarouselConfigForm(**kwargs)[source]¶

Bases: shuup.xtheme.plugins.forms.GenericPluginForm

populate()[source]¶
clean()[source]¶
base_fields = OrderedDict()¶
declared_fields = OrderedDict()¶
media¶

shuup.front.apps.carousel.models module¶

class shuup.front.apps.carousel.models.CarouselMode[source]¶

Bases: enumfields.enums.Enum

An enumeration.

SLIDE = 0¶
FADE = 1¶
class shuup.front.apps.carousel.models.LinkTargetType[source]¶

Bases: enumfields.enums.Enum

An enumeration.

CURRENT = 0¶
NEW = 1¶
class shuup.front.apps.carousel.models.SlideQuerySet(*args, **kwargs)[source]¶

Bases: parler.managers.TranslatableQuerySet

visible(dt=None)[source]¶

Get slides that should be publicly visible.

This does not do permission checking.

Parameters:dt (datetime.datetime) – Datetime for visibility check
Returns:QuerySet of slides.
Return type:QuerySet[Slide]
class shuup.front.apps.carousel.models.Carousel(id, name, animation, interval, pause_on_hover, is_arrows_visible, use_dot_navigation, image_width, image_height, arrows_color)[source]¶

Bases: shuup.core.models.ShuupModel

Parameters:
  • id (AutoField) – Id
  • name (CharField) – The carousel name use for carousel configuration.
  • animation (EnumIntegerField) – Animation type for cycling slides.
  • interval (IntegerField) – Slide interval in seconds.
  • pause_on_hover (BooleanField) – When checked, the carousel cycling pauses on mouse over.
  • is_arrows_visible (BooleanField) – When checked, navigational arrows are shown on the carousel allowing for customers to go back and forward.
  • use_dot_navigation (BooleanField) – When checked, navigational indicator dots are shown.
  • image_width (IntegerField) – Slide images will be cropped to this width.
  • image_height (IntegerField) – Slide images will be cropped to this height.
  • arrows_color (HexColorField) – Set the custom color for the arrows.
  • shops (ManyToManyField to shuup.core.models.Shop) – Select which shops you would like the carousel to be visible in.
slides¶

ManyToOneRel to shuup.front.apps.carousel.models.Slide

shops¶

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

name¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

animation¶

A property descriptor which ensures that field.to_python() is called on _every_ assignment to the field.

This used to be provided by the django.db.models.subclassing.Creator class, which in turn was used by the deprecated-in-Django-1.10 SubfieldBase class, hence the reimplementation here.

interval¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

pause_on_hover¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

is_arrows_visible¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

use_dot_navigation¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

image_width¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

image_height¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

arrows_color¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

animation_class_name¶
exception DoesNotExist¶

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned¶

Bases: django.core.exceptions.MultipleObjectsReturned

get_animation_display(*, field=<enumfields.fields.EnumIntegerField: animation>)¶
id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>¶
slides

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class shuup.front.apps.carousel.models.Slide(id, carousel, name, product_link, category_link, cms_page_link, ordering, target, available_from, available_to, inactive_dot_color, active_dot_color)[source]¶

Bases: shuup.core.models.TranslatableShuupModel

Parameters:
  • id (AutoField) – Id
  • carousel (ForeignKey to shuup.front.apps.carousel.models.Carousel) – Carousel
  • name (CharField) – Name is only used to configure slides.
  • product_link (ForeignKey to shuup.core.models.Product) – Set the product detail page that should be shown when this slide is clicked, if any.
  • category_link (ForeignKey to shuup.core.models.Category) – Set the product category page that should be shown when this slide is clicked, if any.
  • cms_page_link (ForeignKey to shuup.simple_cms.models.Page) – Set the web page that should be shown when the slide is clicked, if any.
  • ordering (IntegerField) – Set the numeric order in which this slide should appear relative to other slides in this carousel.
  • target (EnumIntegerField) – Set this to current if clicking on this slide should open a new browser tab.
  • available_from (DateTimeField) – Set the date and time, starting from which this slide should be visible in the carousel. This is useful to advertise sales campaigns or other time-sensitive marketing.
  • available_to (DateTimeField) – Set the date and time, until which this slide should be visible in the carousel. This is useful to advertise sales campaigns or other time-sensitive marketing.
  • inactive_dot_color (HexColorField) – Customize the dot border color when slide is not active.
  • active_dot_color (HexColorField) – Customize the dot color when slide is active.
  • caption (CharField) – (Translatable) Text that describes the image. It is displayed on top of the image if ‘Render image text’ box is enabled in front-end. Also used for search engine purposes.
  • caption_text (TextField) – (Translatable) Caption text is displayed as secondary text on top of the image if ‘Render image text’ box is enabled in front-end for ‘Carousel plugin’ type (disabled for ‘Banner box’ type). It is also shown as a tooltip.
  • external_link (CharField) – (Translatable) Set the external site that should be shown when this slide is clicked, if any.
  • image (FilerImageField to filer.models.imagemodels.Image) – (Translatable) The slide image to show.
translations¶

ManyToOneRel to shuup.front.apps.carousel.models.SlideTranslation

carousel¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

name¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

product_link¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

category_link¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

cms_page_link¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

ordering¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

target¶

A property descriptor which ensures that field.to_python() is called on _every_ assignment to the field.

This used to be provided by the django.db.models.subclassing.Creator class, which in turn was used by the deprecated-in-Django-1.10 SubfieldBase class, hence the reimplementation here.

available_from¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

available_to¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

inactive_dot_color¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

active_dot_color¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

translations

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

get_translated_field(attr)[source]¶
get_link_url()[source]¶

Get right link url for this slide.

Initially external link is used. If not set link will fallback to product_link, external_link or cms_page_link in this order.

Returns:return correct link url for slide if set
Return type:str|None
is_visible(dt=None)[source]¶

Get slides that should be publicly visible.

This does not do permission checking.

Parameters:dt (datetime.datetime) – Datetime for visibility check
Returns:Public visibility status
Return type:bool
get_link_target()[source]¶

Return link target type string based on selection

Returns:Target type string
Return type:str
easy_thumbnails_thumbnailer¶

Get Thumbnailer instance for the translated image. Will return None if file cannot be thumbnailed. :rtype:easy_thumbnails.files.Thumbnailer|None

get_thumbnail(**kwargs)[source]¶

Get thumbnail for the translated image This will return None if there is no file :rtype: easy_thumbnails.files.ThumbnailFile|None

objects = <django.db.models.manager.ManagerFromSlideQuerySet object>¶
exception DoesNotExist¶

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned¶

Bases: django.core.exceptions.MultipleObjectsReturned

caption¶

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

caption_text¶

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

carousel_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

category_link_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

cms_page_link_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

external_link¶

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

get_target_display(*, field=<enumfields.fields.EnumIntegerField: target>)¶
id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

image¶

Descriptor for translated attributes.

This attribute proxies all get/set calls to the translated model.

product_link_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class shuup.front.apps.carousel.models.SlideTranslation(id, language_code, caption, caption_text, external_link, image, master)¶

Bases: parler.models.TranslatedFieldsModel

Parameters:
  • id (AutoField) – Id
  • language_code (HideChoicesCharField) – Language
  • caption (CharField) – Text that describes the image. It is displayed on top of the image if ‘Render image text’ box is enabled in front-end. Also used for search engine purposes.
  • caption_text (TextField) – Caption text is displayed as secondary text on top of the image if ‘Render image text’ box is enabled in front-end for ‘Carousel plugin’ type (disabled for ‘Banner box’ type). It is also shown as a tooltip.
  • external_link (CharField) – Set the external site that should be shown when this slide is clicked, if any.
  • image (FilerImageField to filer.models.imagemodels.Image) – The slide image to show.
  • master (TranslationsForeignKey to shuup.front.apps.carousel.models.Slide) – Master
exception DoesNotExist¶

Bases: parler.models.TranslationDoesNotExist, shuup.front.apps.carousel.models.DoesNotExist, shuup.front.apps.carousel.models.DoesNotExist

exception MultipleObjectsReturned¶

Bases: django.core.exceptions.MultipleObjectsReturned

caption¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

caption_text¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

external_link¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

image¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

image_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

master¶

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

master_id¶

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>¶

shuup.front.apps.carousel.plugins module¶

class shuup.front.apps.carousel.plugins.CarouselPlugin(config)[source]¶

Bases: shuup.xtheme.TemplatedPlugin

Instantiate a Plugin with the given config dictionary.

Parameters:config (dict) – Dictionary of freeform configuration data
identifier = 'shuup.front.apps.carousel.carousel'¶
name = 'Carousel Plugin'¶
template_name = 'shuup/carousel/carousel.jinja'¶
cacheable = True¶
fields = [('carousel', None), ('render_image_text', <django.forms.fields.BooleanField object>)]¶
editor_form_class¶

alias of CarouselConfigForm

get_defaults()[source]¶
get_cache_key(context, **kwargs) → str[source]¶
get_context_data(context)[source]¶

Use only slides that has translated image in current language

Parameters:context – current context
Returns:updated plugin context
Return type:dict
class shuup.front.apps.carousel.plugins.BannerBoxPlugin(config)[source]¶

Bases: shuup.front.apps.carousel.plugins.CarouselPlugin

Instantiate a Plugin with the given config dictionary.

Parameters:config (dict) – Dictionary of freeform configuration data
identifier = 'shuup.front.apps.carousel.banner_box'¶
name = 'Banner Box'¶
editor_form_class¶

alias of CarouselConfigForm

fields = [('title', <shuup.xtheme.plugins.forms.TranslatableField object>), ('render_image_text', <django.forms.fields.BooleanField object>)]¶
get_context_data(context)[source]¶

Add title from config to context data

Parameters:context – Current context
Returns:updated Plugin context
Return type:dict

Module contents¶


© Copyright 2021, Shuup Commerce Inc.. Revision 11a968a6.

Built with Sphinx using Sphinx Shoop Theme.