shuup.gdpr package

Submodules

shuup.gdpr.anonymizer module

class shuup.gdpr.anonymizer.Anonymizer[source]

Bases: object

mapping = {'phone': 'null_phone', 'ip_address': 'null_ip', 'first_name': 'null_name', 'last_name': 'null_name', 'name': 'null_name', 'postal_code': 'null_zip', 'zip_code': 'null_zip', 'www': 'blank_value', 'prefix': 'blank_value', 'suffix': 'blank_value', 'name_ext': 'blank_value', 'merchant_notes': 'blank_value', 'street': 'random_string', 'street1': 'random_string', 'street2': 'random_string', 'street3': 'random_string', 'street_address': 'random_string', 'tax_number': 'random_number', 'city': 'random_string', 'longitude': 'none_value', 'latitude': 'none_value', 'birth_date': 'none_value', 'data': 'none_value', 'email': 'null_email', 'username': 'random_username'}
random_string(len=8)[source]
none_value()[source]
blank_value()[source]
null_zip()[source]
null_ip()[source]
null_email()[source]
null_name()[source]
null_phone()[source]
random_number()[source]
random_username()[source]
anonymize_contact(pk)[source]
anonymize_company(company)[source]
anonymize_person(person)[source]
anonymize_order(order)[source]
anonymize_object(obj, save=True)[source]
anonymize_queryset(qs)[source]
anonymize_user(user)[source]

shuup.gdpr.apps module

class shuup.gdpr.apps.AppConfig(*args, **kwargs)[source]

Bases: shuup.apps.AppConfig

name = 'shuup.gdpr'
label = 'shuup_gdpr'
provides = {'admin_module': ['shuup.gdpr.admin_module.GDPRModule'], 'front_urls': ['shuup.gdpr.urls:urlpatterns'], 'customer_dashboard_items': ['shuup.gdpr.dashboard_items:GDPRDashboardItem'], 'admin_contact_toolbar_action_item': ['shuup.gdpr.admin_module.toolbar:AnonymizeContactToolbarButton', 'shuup.gdpr.admin_module.toolbar:DownloadDataToolbarButton'], 'xtheme_resource_injection': ['shuup.gdpr.resources:add_gdpr_consent_resources'], 'front_registration_field_provider': ['shuup.gdpr.providers:GDPRRegistrationFieldProvider'], 'front_auth_form_field_provider': ['shuup.gdpr.providers:GDPRAuthFieldProvider'], 'checkout_confirm_form_field_provider': ['shuup.gdpr.providers:GDPRCheckoutFieldProvider'], 'front_company_registration_form_provider': ['shuup.gdpr.providers:GDPRFormDefProvider']}
ready()[source]

shuup.gdpr.dashboard_items module

class shuup.gdpr.dashboard_items.GDPRDashboardItem(request)[source]

Bases: shuup.front.utils.dashboard.DashboardItem

template_name = None
title = 'My Data'
icon = 'fa fa-shield'
description = 'Customer data'
show_on_dashboard()[source]

shuup.gdpr.forms module

class shuup.gdpr.forms.CompanyAgreementForm(**kwargs)[source]

Bases: django.forms.forms.Form

base_fields = OrderedDict()
declared_fields = OrderedDict()
media

shuup.gdpr.models module

shuup.gdpr.models.get_setting(shop)[source]
class shuup.gdpr.models.GDPRSettings(id, shop, enabled, skip_consent_on_auth, privacy_policy_page)[source]

Bases: parler.models.TranslatableModel

Parameters:
  • id (AutoField) – Id
  • shop (OneToOneField to shuup.core.models.Shop) – Shop
  • enabled (BooleanField) – Define if the GDPR is active.
  • skip_consent_on_auth (BooleanField) – Do not require consent on login when GDPR is activated.
  • privacy_policy_page (ForeignKey to shuup.simple_cms.models.Page) – Choose your privacy policy page here. If this page changes, customers will be prompted for new consent.
  • consent_pages (ManyToManyField to shuup.simple_cms.models.Page) – Choose pages here which are being monitored for customer consent. If any of these pages change, the customer is being prompted for a new consent.
  • cookie_banner_content (TextField) – (Translatable) The text to be presented to users in a pop-up warning.
  • cookie_privacy_excerpt (TextField) – (Translatable) The summary text to be presented about cookie privacy.
  • auth_consent_text (TextField) – (Translatable) Shown in login page between the form and the button. Optional, but should be considered when the consent on login is disabled.
translations

ManyToOneRel to shuup.gdpr.models.GDPRSettingsTranslation

shop

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

enabled

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

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

privacy_policy_page

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.

consent_pages

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.

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.

set_default_content()[source]
classmethod get_for_shop(shop)[source]
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Descriptor for translated attributes.

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

cookie_banner_content

Descriptor for translated attributes.

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

cookie_privacy_excerpt

Descriptor for translated attributes.

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

id

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

privacy_policy_page_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.

class shuup.gdpr.models.GDPRCookieCategory(id, shop, always_active, default_active, cookies)[source]

Bases: parler.models.TranslatableModel

Parameters:
  • id (AutoField) – Id
  • shop (ForeignKey to shuup.core.models.Shop) – Shop
  • always_active (BooleanField) – Always active
  • default_active (BooleanField) – whether this cookie category is active by default
  • cookies (TextField) – Comma separated list of cookies names, prefix or suffix that will be included in this category, e.g. _ga, mysession, user_c_
  • name (CharField) – (Translatable) Name
  • how_is_used (TextField) – (Translatable) Describe the purpose of this category of cookies and how it is used.
translations

ManyToOneRel to shuup.gdpr.models.GDPRCookieCategoryTranslation

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.

always_active

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

default_active

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

cookies

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

how_is_used

Descriptor for translated attributes.

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

id

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

name

Descriptor for translated attributes.

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

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.gdpr.models.GDPRUserConsent(id, created_on, shop, user)[source]

Bases: django.db.models.base.Model

Parameters:
created_on

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

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.

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.

documents

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.

classmethod ensure_for_user(user, shop, consent_documents)[source]
classmethod get_for_user(user, shop)[source]
should_reconsent(shop, user)[source]
should_reconsent_to_page(page)[source]
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)
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>
shop_id

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

user_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.gdpr.models.GDPRUserConsentDocument(id, page, version)[source]

Bases: django.db.models.base.Model

Parameters:
  • id (AutoField) – Id
  • page (ForeignKey to shuup.simple_cms.models.Page) – Page
  • version (ForeignKey to reversion.models.Version) – Version
page

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.

version

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.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

gdpruserconsent_set

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.

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

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

version_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.gdpr.models.GDPRCookieCategoryTranslation(id, language_code, name, how_is_used, master)

Bases: parler.models.TranslatedFieldsModel

Parameters:
  • id (AutoField) – Id
  • language_code (HideChoicesCharField) – Language
  • name (CharField) – Name
  • how_is_used (TextField) – Describe the purpose of this category of cookies and how it is used.
  • master (TranslationsForeignKey to shuup.gdpr.models.GDPRCookieCategory) – Master
exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shuup.gdpr.models.DoesNotExist, shuup.gdpr.models.DoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

how_is_used

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.

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.

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>
class shuup.gdpr.models.GDPRSettingsTranslation(id, language_code, cookie_banner_content, cookie_privacy_excerpt, auth_consent_text, master)

Bases: parler.models.TranslatedFieldsModel

Parameters:
  • id (AutoField) – Id
  • language_code (HideChoicesCharField) – Language
  • cookie_banner_content (TextField) – The text to be presented to users in a pop-up warning.
  • cookie_privacy_excerpt (TextField) – The summary text to be presented about cookie privacy.
  • auth_consent_text (TextField) – Shown in login page between the form and the button. Optional, but should be considered when the consent on login is disabled.
  • master (TranslationsForeignKey to shuup.gdpr.models.GDPRSettings) – Master
exception DoesNotExist

Bases: parler.models.TranslationDoesNotExist, shuup.gdpr.models.DoesNotExist, shuup.gdpr.models.DoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

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

cookie_banner_content

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

cookie_privacy_excerpt

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.

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.gdpr.providers module

class shuup.gdpr.providers.TextOnlyWidget(attrs=None)[source]

Bases: django.forms.widgets.Widget

render(name, value, attrs=None, renderer=None)[source]
media
class shuup.gdpr.providers.GDPRFormDefProvider(source, request, **kwargs)[source]

Bases: shuup.front.providers.form_def.FormDefProvider

get_definitions(**kwargs)[source]
shuup.gdpr.providers.get_gdpr_settings(request)[source]
class shuup.gdpr.providers.GDPRFieldProvider(**kwargs)[source]

Bases: shuup.front.providers.form_fields.FormFieldProvider

error_message = ''
get_fields(**kwargs)[source]
class shuup.gdpr.providers.GDPRRegistrationFieldProvider(**kwargs)[source]

Bases: shuup.gdpr.providers.GDPRFieldProvider

error_message = 'You must accept this in order to register.'
class shuup.gdpr.providers.GDPRCheckoutFieldProvider(**kwargs)[source]

Bases: shuup.gdpr.providers.GDPRFieldProvider

error_message = 'You must accept this to order.'
class shuup.gdpr.providers.GDPRAuthFieldProvider(**kwargs)[source]

Bases: shuup.gdpr.providers.GDPRFieldProvider

error_message = 'You must accept this in order to authenticate.'
get_fields(**kwargs)[source]

shuup.gdpr.receivers module

shuup.gdpr.receivers.create_consents_company_registration_save(sender, request, user, company, *args, **kwargs)[source]
shuup.gdpr.receivers.create_consents_person_registration_save(sender, request, user, contact, *args, **kwargs)[source]
shuup.gdpr.receivers.create_consents_login_allowed(sender, request, user, *args, **kwargs)[source]
shuup.gdpr.receivers.create_consents_checkout_complete(sender, request, user, order, *args, **kwargs)[source]

shuup.gdpr.resources module

shuup.gdpr.resources.valid_view(context)[source]

shuup.gdpr.serializers module

class shuup.gdpr.serializers.ContactLogEntrySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of ContactGroupLogEntry

exclude = ()
class shuup.gdpr.serializers.CompanyContactLogEntrySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: shuup.gdpr.serializers.ContactLogEntrySerializer

class Meta[source]

Bases: object

model

alias of CompanyContactLogEntry

exclude = ()
class shuup.gdpr.serializers.PersonContactLogEntrySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: shuup.gdpr.serializers.ContactLogEntrySerializer

class Meta[source]

Bases: object

model

alias of PersonContactLogEntry

exclude = ()
class shuup.gdpr.serializers.GDPRConsentDocumentSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.Serializer

class shuup.gdpr.serializers.GDPRConsentCookieCategorySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of GDPRCookieCategory

exclude = ()
class shuup.gdpr.serializers.GDPRConsentSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of GDPRUserConsent

exclude = ()
class shuup.gdpr.serializers.UserSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of User

exclude = ('password',)
class shuup.gdpr.serializers.AddressSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of MutableAddress

exclude = ()
class shuup.gdpr.serializers.OrderLineSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of OrderLine

exclude = ()
class shuup.gdpr.serializers.OrderSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of Order

exclude = ()
class shuup.gdpr.serializers.SavedAddressSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of SavedAddress

exclude = ()
class shuup.gdpr.serializers.CoreBasketSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of Basket

exclude = ()
class shuup.gdpr.serializers.FrontSavedBasketSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of StoredBasket

exclude = ()
class shuup.gdpr.serializers.ContactSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of Contact

exclude = ('polymorphic_ctype',)
class shuup.gdpr.serializers.GDPRCompanyContactSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

model

alias of CompanyContact

fields = '__all__'
class shuup.gdpr.serializers.GDPRPersonContactSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]

Bases: shuup.gdpr.serializers.ContactSerializer

class Meta[source]

Bases: object

model

alias of PersonContact

exclude = ('polymorphic_ctype',)

shuup.gdpr.settings module

shuup.gdpr.signal_handlers module

shuup.gdpr.signal_handlers.handle_settings_post_save(sender, instance, **kwargs)[source]

shuup.gdpr.urls module

shuup.gdpr.utils module

Parameters:cookie_categories (list[GDPRCookieCategory]) – list of cookie category
shuup.gdpr.utils.get_all_contact_data(contact)[source]
shuup.gdpr.utils.ensure_gdpr_privacy_policy(shop, force_update=False)[source]
shuup.gdpr.utils.should_reconsent_privacy_policy(shop, user)[source]

Returns whether the user has consent to the lastest document versions

Create user consent for all available GDPR documents

shuup.gdpr.utils.get_privacy_policy_page(shop)[source]

shuup.gdpr.views module

class shuup.gdpr.views.GDPRCookieConsentView(**kwargs)[source]

Bases: django.views.generic.base.View

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

post(request, *args, **kwargs)[source]
class shuup.gdpr.views.GDPRPolicyConsentView(**kwargs)[source]

Bases: django.views.generic.base.View

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

dispatch(request, *args, **kwargs)[source]
class shuup.gdpr.views.GDPRCustomerDashboardView(**kwargs)[source]

Bases: shuup.front.views.dashboard.DashboardViewMixin, django.views.generic.base.TemplateView

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

template_name = 'shuup/gdpr/edit_customer_data.jinja'
get_context_data(**kwargs)[source]
class shuup.gdpr.views.GDPRDownloadDataView(**kwargs)[source]

Bases: django.views.generic.base.View

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

post(request, *args, **kwargs)[source]
class shuup.gdpr.views.GDPRAnonymizeView(**kwargs)[source]

Bases: django.views.generic.base.View

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

post(request, *args, **kwargs)[source]

Module contents