shuup.notify.models package

Submodules

shuup.notify.models.email_template module

class shuup.notify.models.email_template.EmailTemplate(id, name, template)[source]

Bases: django.db.models.base.Model

Parameters:
  • id (AutoField) – Id
  • name (CharField) – Name
  • template (TextField) – Enter the base HTML template to be used in emails. Mark the place to inject the email content using the variable %html_body% inside the body.
name

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

template

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

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

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.notify.models.notification module

class shuup.notify.models.notification.NotificationManager[source]

Bases: django.db.models.manager.Manager

for_user(user)[source]
unread_for_user(user)[source]
class shuup.notify.models.notification.Notification(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A model for persistent notifications to be shown in the admin, etc.

Parameters:
  • id (AutoField) – Id
  • shop (ForeignKey to shuup.core.models.Shop) – Shop
  • recipient_type (EnumIntegerField) – Recipient type
  • recipient (ForeignKey to django.contrib.auth.models.User) – Recipient
  • created_on (DateTimeField) – Created on
  • message (CharField) – Message
  • identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
  • priority (EnumIntegerField) – Priority
  • _data (JSONField) – data
  • marked_read (BooleanField) – Marked read
  • marked_read_by (ForeignKey to django.contrib.auth.models.User) – Marked read by
  • marked_read_on (DateTimeField) – Marked read on
shop

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.

recipient_type

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.

recipient

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.

created_on

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

message

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

identifier

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

priority

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.

marked_read

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

marked_read_by

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.

marked_read_on

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

objects = <shuup.notify.models.notification.NotificationManager object>
save(*args, **kwargs)[source]
mark_read(user)[source]
is_read
data
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_priority_display(*, field=<enumfields.fields.EnumIntegerField: priority>)
get_recipient_type_display(*, field=<enumfields.fields.EnumIntegerField: recipient_type>)
id

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

marked_read_by_id

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

recipient_id

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

shop_id

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

url
set_reverse_url(**reverse_kwargs)[source]

shuup.notify.models.script module

class shuup.notify.models.script.Script(id, shop, event_identifier, identifier, created_on, name, enabled, _step_data, template)[source]

Bases: django.db.models.base.Model

Parameters:
  • id (AutoField) – Id
  • shop (ForeignKey to shuup.core.models.Shop) – Shop
  • event_identifier (CharField) – Event identifier
  • identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
  • created_on (DateTimeField) – Created on
  • name (CharField) – Name
  • enabled (BooleanField) – Enabled
  • _step_data (JSONField) – step data
  • template (CharField) – the template identifier used to create this script
log_entries

ManyToOneRel to shuup.notify.models.script.ScriptLogEntry

shop

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.

event_identifier

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

identifier

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

created_on

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

name

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

enabled

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

template

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

get_steps()[source]

:rtype Iterable[Step]

set_steps(steps)[source]
get_serialized_steps()[source]
set_serialized_steps(serialized_data)[source]
event_class
execute(context)[source]

Execute the script in the given context.

Parameters:context (shuup.notify.script.Context) – Script context
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
id

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

log_entries

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.

objects = <django.db.models.manager.Manager object>
shop_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.notify.models.script.ScriptLogEntry(id, created_on, user, message, identifier, kind, extra, target)

Bases: shuup.utils.analog.BaseLogEntry

Parameters:
  • id (AutoField) – Id
  • created_on (DateTimeField) – Created on
  • user (ForeignKey to django.contrib.auth.models.User) – User
  • message (CharField) – Message
  • identifier (CharField) – Identifier
  • kind (EnumIntegerField) – Log entry kind
  • extra (JSONField) – Extra data
  • target (ForeignKey to shuup.notify.models.script.Script) – Target
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

extra

A placeholder class that provides a way to set the attribute on the model.

get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
id

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

kind

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.

logged_model

alias of Script

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

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.

target_id

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

user

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.

Module contents

class shuup.notify.models.EmailTemplate(id, name, template)[source]

Bases: django.db.models.base.Model

Parameters:
  • id (AutoField) – Id
  • name (CharField) – Name
  • template (TextField) – Enter the base HTML template to be used in emails. Mark the place to inject the email content using the variable %html_body% inside the body.
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

id

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

name

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>
template

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

class shuup.notify.models.Notification(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A model for persistent notifications to be shown in the admin, etc.

Parameters:
  • id (AutoField) – Id
  • shop (ForeignKey to shuup.core.models.Shop) – Shop
  • recipient_type (EnumIntegerField) – Recipient type
  • recipient (ForeignKey to django.contrib.auth.models.User) – Recipient
  • created_on (DateTimeField) – Created on
  • message (CharField) – Message
  • identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
  • priority (EnumIntegerField) – Priority
  • _data (JSONField) – data
  • marked_read (BooleanField) – Marked read
  • marked_read_by (ForeignKey to django.contrib.auth.models.User) – Marked read by
  • marked_read_on (DateTimeField) – Marked read on
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

created_on

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

data
get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_priority_display(*, field=<enumfields.fields.EnumIntegerField: priority>)
get_recipient_type_display(*, field=<enumfields.fields.EnumIntegerField: recipient_type>)
id

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

identifier

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

is_read
mark_read(user)[source]
marked_read

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

marked_read_by

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.

marked_read_by_id

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

marked_read_on

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

message

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

objects = <shuup.notify.models.notification.NotificationManager object>
priority

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.

recipient

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.

recipient_id

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

recipient_type

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.

save(*args, **kwargs)[source]
set_reverse_url(**reverse_kwargs)[source]
shop

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.

shop_id

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

url
class shuup.notify.models.Script(id, shop, event_identifier, identifier, created_on, name, enabled, _step_data, template)[source]

Bases: django.db.models.base.Model

Parameters:
  • id (AutoField) – Id
  • shop (ForeignKey to shuup.core.models.Shop) – Shop
  • event_identifier (CharField) – Event identifier
  • identifier (InternalIdentifierField) – Do not change this value if you are not sure what you are doing.
  • created_on (DateTimeField) – Created on
  • name (CharField) – Name
  • enabled (BooleanField) – Enabled
  • _step_data (JSONField) – step data
  • template (CharField) – the template identifier used to create this script
log_entries

ManyToOneRel to shuup.notify.models.script.ScriptLogEntry

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

add_log_entry(message, identifier=None, kind=<LogEntryKind.OTHER: 0>, user=None, extra=None, save=True)
created_on

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

enabled

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

event_class
event_identifier

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

execute(context)[source]

Execute the script in the given context.

Parameters:context (shuup.notify.script.Context) – Script context
get_next_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=True, **kwargs)
get_previous_by_created_on(*, field=<django.db.models.fields.DateTimeField: created_on>, is_next=False, **kwargs)
get_serialized_steps()[source]
get_steps()[source]

:rtype Iterable[Step]

id

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

identifier

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

log_entries

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.

name

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>
set_serialized_steps(serialized_data)[source]
set_steps(steps)[source]
shop

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.

shop_id

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

template

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