shuup.gdpr package

Subpackages

Submodules

shuup.gdpr.anonymizer module

class shuup.gdpr.anonymizer.Anonymizer[source]

Bases: object

mapping = {'birth_date': '_none_value', 'city': '_random_string', 'data': '_none_value', 'email': '_null_email', 'first_name': '_null_name', 'ip_address': '_null_ip', 'last_name': '_null_name', 'latitude': '_none_value', 'longitude': '_none_value', 'merchant_notes': '_blank_value', 'name': '_null_name', 'name_ext': '_blank_value', 'phone': '_null_phone', 'postal_code': '_null_zip', 'prefix': '_blank_value', 'street': '_random_string', 'street1': '_random_string', 'street2': '_random_string', 'street3': '_random_string', 'street_address': '_random_string', 'suffix': '_blank_value', 'tax_number': '_random_number', 'username': '_random_username', 'www': '_blank_value', 'zip_code': '_null_zip'}
anonymize(shop: Shop, contact: Contact = None, user: User = None)[source]

shuup.gdpr.apps module

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

Bases: AppConfig

name = 'shuup.gdpr'
label = 'shuup_gdpr'
default_auto_field = 'django.db.models.BigAutoField'
provides = {'admin_contact_toolbar_action_item': ['shuup.gdpr.admin_module.toolbar:AnonymizeContactToolbarButton', 'shuup.gdpr.admin_module.toolbar:DownloadDataToolbarButton'], 'admin_module': ['shuup.gdpr.admin_module.GDPRModule'], 'checkout_confirm_form_field_provider': ['shuup.gdpr.providers:GDPRCheckoutFieldProvider'], 'customer_dashboard_items': ['shuup.gdpr.dashboard_items:GDPRDashboardItem'], 'front_auth_form_field_provider': ['shuup.gdpr.providers:GDPRAuthFieldProvider'], 'front_company_registration_form_provider': ['shuup.gdpr.providers:GDPRFormDefProvider'], 'front_registration_field_provider': ['shuup.gdpr.providers:GDPRRegistrationFieldProvider'], 'front_urls': ['shuup.gdpr.urls:urlpatterns'], 'notify_event': ['shuup.tasks.notify_events:TaskCreated'], 'xtheme_resource_injection': ['shuup.gdpr.resources:add_gdpr_consent_resources'], 'xtheme_snippet_blocker': ['shuup.gdpr.snippet_blocker.GDPRSnippetBlocker']}

See /provides for details about the provides variable.

ready()[source]

Override this method in subclasses to run code when Django starts.

shuup.gdpr.dashboard_items module

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

Bases: DashboardItem

template_name = None

Title shown in dashboard menu and in dashboard

title = 'My Data'

Sequence number of dashboard item

icon = 'fa fa-shield'

Text for dashboard

If your dashboard item shows single object, Edit is just fine but if you are listing objects, Show All might be better.

description = 'Customer data'
show_on_dashboard()[source]

Defines if the item is shown in dashboard

Returns:

True or False if item should be shown in dashboard

Return type:

bool

shuup.gdpr.forms module

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

Bases: Form

__init__(**kwargs)[source]
base_fields = {}
declared_fields = {}
property media

Return all media required to render the widgets on this form.

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: TranslatableModel

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: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: 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
shop_id
class shuup.gdpr.models.GDPRCookieCategory(id, shop, always_active, default_active, cookies)[source]

Bases: TranslatableModel

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.

block_snippets

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.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

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

Bases: Model

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: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: 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
user_id
class shuup.gdpr.models.GDPRUserConsentDocument(id, page, version)[source]

Bases: Model

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: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: 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
version_id
class shuup.gdpr.models.GDPRCookieCategoryTranslation(id, language_code, name, how_is_used, master)

Bases: TranslatedFieldsModel

exception DoesNotExist

Bases: TranslationDoesNotExist, DoesNotExist, DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

get_language_code_display(*, field=<parler.utils.compat.HideChoicesCharField: language_code>)
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

The mandatory Foreign key field to the shared model.

master_id
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: TranslatedFieldsModel

exception DoesNotExist

Bases: TranslationDoesNotExist, DoesNotExist, DoesNotExist

exception MultipleObjectsReturned

Bases: 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.

get_language_code_display(*, field=<parler.utils.compat.HideChoicesCharField: language_code>)
id

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

master

The mandatory Foreign key field to the shared model.

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

shuup.gdpr.providers module

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

Bases: Widget

render(name, value, attrs=None, renderer=None)[source]

Render the widget as an HTML string.

property media
class shuup.gdpr.providers.GDPRFormDefProvider(source, request, **kwargs)[source]

Bases: FormDefProvider

get_definitions(**kwargs)[source]
Returns:

list of `FormDefinition`s

Return type:

list[shuup.front.providers.form_def.FormDefinition]

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

Bases: FormFieldProvider

error_message = ''
get_fields(**kwargs)[source]

Get a list of field definitions

Returns:

list of `FormFieldDefinition`s

Return type:

list[shuup.front.providers.form_fields.FormFieldDefinition]

class shuup.gdpr.providers.GDPRRegistrationFieldProvider(**kwargs)[source]

Bases: GDPRFieldProvider

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

Bases: GDPRFieldProvider

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

Bases: GDPRFieldProvider

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

Get a list of field definitions

Returns:

list of `FormFieldDefinition`s

Return type:

list[shuup.front.providers.form_fields.FormFieldDefinition]

class shuup.gdpr.providers.GDPRBaseUserDataProvider[source]

Bases: object

classmethod get_user_data(shop: Shop, user: User = None, contact: Contact = None) Tuple[str, Dict][source]

Returns a tuple of string, dictionary. The string is the key that identifies the data and the dict contains all the user data this provider returns.

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(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of ContactGroupLogEntry

exclude = ()
class shuup.gdpr.serializers.CompanyContactLogEntrySerializer(*args, **kwargs)[source]

Bases: ContactLogEntrySerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of CompanyContactLogEntry

exclude = ()
class shuup.gdpr.serializers.PersonContactLogEntrySerializer(*args, **kwargs)[source]

Bases: ContactLogEntrySerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of PersonContactLogEntry

exclude = ()
class shuup.gdpr.serializers.GDPRConsentDocumentSerializer(*args, **kwargs)[source]

Bases: Serializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class shuup.gdpr.serializers.GDPRConsentCookieCategorySerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of GDPRCookieCategory

exclude = ()
class shuup.gdpr.serializers.GDPRConsentSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of GDPRUserConsent

exclude = ()
class shuup.gdpr.serializers.UserSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of User

exclude = ('password',)
class shuup.gdpr.serializers.AddressSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of MutableAddress

exclude = ()
class shuup.gdpr.serializers.OrderLineSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of OrderLine

exclude = ()
class shuup.gdpr.serializers.OrderSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of Order

exclude = ()
class shuup.gdpr.serializers.SavedAddressSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of SavedAddress

exclude = ()
class shuup.gdpr.serializers.CoreBasketSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of Basket

exclude = ()
class shuup.gdpr.serializers.FrontSavedBasketSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of StoredBasket

exclude = ()
class shuup.gdpr.serializers.ContactSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of Contact

exclude = ('polymorphic_ctype',)
class shuup.gdpr.serializers.GDPRCompanyContactSerializer(*args, **kwargs)[source]

Bases: ModelSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

class Meta[source]

Bases: object

model

alias of CompanyContact

fields = '__all__'
class shuup.gdpr.serializers.GDPRPersonContactSerializer(*args, **kwargs)[source]

Bases: ContactSerializer

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

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(shop, 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: 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: 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: DashboardViewMixin, 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: 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: View

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

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

Module contents