Customer¶
The customer app includes models to record product alerts and sent emails. It also contains the views that allow a customer to manage their data (profile information, shipping addresses, etc.)
Abstract models¶
-
class
oscar.apps.customer.abstract_models.
AbstractProductAlert
(*args, **kwargs)[source]¶ An alert for when a product comes back in stock
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
-
class
oscar.apps.customer.abstract_models.
AbstractUser
(*args, **kwargs)[source]¶ An abstract base user suitable for use in Oscar projects.
This is basically a copy of the core AbstractUser model but without a username field
-
clean
()[source]¶ Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
-
save
(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
Forms¶
-
class
oscar.apps.customer.forms.
ConfirmPasswordForm
(user, *args, **kwargs)[source]¶ Extends the standard django AuthenticationForm, to support 75 character usernames. 75 character usernames are needed to support the EmailOrUsername authentication backend.
-
class
oscar.apps.customer.forms.
EmailAuthenticationForm
(host, *args, **kwargs)[source]¶ Extends the standard django AuthenticationForm, to support 75 character usernames. 75 character usernames are needed to support the EmailOrUsername authentication backend.
-
class
oscar.apps.customer.forms.
OrderSearchForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶
-
class
oscar.apps.customer.forms.
PasswordResetForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶ This form takes the same structure as its parent from
django.contrib.auth
-
class
oscar.apps.customer.forms.
ProductAlertForm
(user, product, *args, **kwargs)[source]¶
-
oscar.apps.customer.forms.
ProfileForm
¶ alias of
oscar.apps.customer.forms.UserForm
Views¶
-
class
oscar.apps.customer.views.
AccountAuthView
(**kwargs)[source]¶ This is actually a slightly odd double form view that allows a customer to either login or register.
-
login_form_class
¶
-
registration_form_class
¶
-
-
class
oscar.apps.customer.views.
AccountRegistrationView
(**kwargs)[source]¶ -
form_class
¶
-
-
class
oscar.apps.customer.views.
AccountSummaryView
(**kwargs)[source]¶ View that exists for legacy reasons and customisability. It commonly gets called when the user clicks on “Account” in the navbar.
Oscar defaults to just redirecting to the profile summary page (and that redirect can be configured via OSCAR_ACCOUNT_REDIRECT_URL), but it’s also likely you want to display an ‘account overview’ page or such like. The presence of this view allows just that, without having to change a lot of templates.
-
class
oscar.apps.customer.views.
AddressChangeStatusView
(**kwargs)[source]¶ Sets an address as default_for_(billing|shipping)
-
class
oscar.apps.customer.views.
AddressCreateView
(**kwargs)[source]¶ -
form_class
¶ alias of
oscar.apps.address.forms.UserAddressForm
-
model
¶ alias of
oscar.apps.address.models.UserAddress
-
-
class
oscar.apps.customer.views.
AddressDeleteView
(**kwargs)[source]¶ -
get_queryset
()[source]¶ Return the QuerySet that will be used to look up the object.
This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.
-
model
¶ alias of
oscar.apps.address.models.UserAddress
-
-
class
oscar.apps.customer.views.
AddressUpdateView
(**kwargs)[source]¶ -
form_class
¶ alias of
oscar.apps.address.forms.UserAddressForm
-
get_queryset
()[source]¶ Return the QuerySet that will be used to look up the object.
This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.
-
model
¶ alias of
oscar.apps.address.models.UserAddress
-
-
class
oscar.apps.customer.views.
AnonymousOrderDetailView
(**kwargs)[source]¶ -
get_object
(queryset=None)[source]¶ Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
-
model
¶ alias of
oscar.apps.order.models.Order
-
-
class
oscar.apps.customer.views.
ChangePasswordView
(**kwargs)[source]¶ -
form_class
¶ alias of
django.contrib.auth.forms.PasswordChangeForm
-
-
class
oscar.apps.customer.views.
EmailDetailView
(**kwargs)[source]¶ Customer email
-
class
oscar.apps.customer.views.
OrderDetailView
(**kwargs)[source]¶ -
do_reorder
(order)[source]¶ ‘Re-order’ a previous order.
This puts the contents of the previous order into your basket
-
get_object
(queryset=None)[source]¶ Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
-
get_template_names
()[source]¶ Return a list of template names to be used for the request. May not be called if render_to_response() is overridden. Return the following list:
the value of
template_name
on the view (if provided)the contents of the
template_name_field
field on the object instance that the view is operating upon (if available)<app_label>/<model_name><template_name_suffix>.html
-
model
¶ alias of
oscar.apps.order.models.Order
-
-
class
oscar.apps.customer.views.
OrderHistoryView
(**kwargs)[source]¶ Customer order history
-
form_class
¶
-
model
¶ alias of
oscar.apps.order.models.Order
-
-
class
oscar.apps.customer.views.
ProfileUpdateView
(**kwargs)[source]¶ -
form_class
¶ alias of
oscar.apps.customer.forms.UserForm
-
Alerts¶
The alerts module provides functionality that allows customers to sign up for email alerts when out-of-stock products come back in stock. A form for signing up is displayed on product detail pages when a product is not in stock.
If the OSCAR_EAGER_ALERTS
setting is True
, then alerts are sent as soon
as affected stock records are updated. Alternatively, the management command
oscar_send_alerts
can be used to send alerts periodically.
The context for the alert email body contains a hurry
variable that is set
to True
if the number of active alerts for a product is greater than the
quantity of the product available in stock.
CustomerDispatcher¶
oscar.apps.customer.utils.CustomerDispatcher
is used to send customer emails
(e.g., registration, password reset, order confirmations).
AlertsDispatcher¶
oscar.apps.customer.alerts.utils.AlertsDispatcher
is used to send product alerts.