Settings

A reference for Salesman’s settings module located at salesman/conf.py.

To use it in project:

from salesman.conf import app_settings

format_price = app_settings.SALESMAN_PRICE_FORMATTER
class salesman.conf.AppSettings[source]
SALESMAN_PRODUCT_TYPES

A dictionary of product types and their respected serializers that are availible for purchase as product. Should be formated as 'app_label.Model': 'path.to.Serializer'.

SALESMAN_BASKET_MODIFIERS

A list of strings formated as path.to.CustomModifier. Modifiers must extend salesman.basket.modifiers.BasketModifier class. and define a unique identifier attribute.

SALESMAN_BASKET_ITEM_VALIDATOR

A dotted path to basket item validator function.

property SALESMAN_BASKET_MODEL: str

A dotted path to the Basket model. Must be set before migrations.

property SALESMAN_BASKET_ITEM_MODEL: str

A dotted path to the Basket Item model. Must be set before migrations.

SALESMAN_PAYMENT_METHODS

A list of strings formated as path.to.CustomPayment. Payments must extend salesman.checkout.payment.PaymentMethod class and define a unique identifier attribute.

SALESMAN_ORDER_STATUS

A dotted path to enum class that contains available order statuses. Overriden class must extend salesman.orders.status.BaseOrderStatus class. Can optionally override a class method get_payable that returns a list of statuses an order is eligible to be paid from, get_transitions method that returns a dict of statuses with their transitions and validate_transition method to validate status transitions.

SALESMAN_ORDER_REFERENCE_GENERATOR

A dotted path to reference generator function for new orders. Function should accept a django request object as param: request.

SALESMAN_ORDER_SERIALIZER

A dotted path to a serializer class for Order.

SALESMAN_ORDER_SUMMARY_SERIALIZER

A dotted path to a summary serializer class for Order.

property SALESMAN_ORDER_MODEL: str

A dotted path to the Order model. Must be set before migrations.

property SALESMAN_ORDER_ITEM_MODEL: str

A dotted path to the Order Item model. Must be set before migrations.

property SALESMAN_ORDER_PAYMENT_MODEL: str

A dotted path to the Order Payment model. Must be set before migrations.

property SALESMAN_ORDER_NOTE_MODEL: str

A dotted path to the Order Note model. Must be set before migrations.

SALESMAN_PRICE_FORMATTER

A dotted path to price formatter function. Function should accept a value of type: Decimal and return a price formatted string. Also recieves a context dictionary with additional render data like request and either the basket or order object.

SALESMAN_ADDRESS_VALIDATOR

A dotted path to address validator function. Function should accept a string value and return a validated version. Also recieves a context dictionary with additional validator context data like request, a basket object and address type (set to either shipping or billing).

SALESMAN_EXTRA_VALIDATOR

A dotted path to extra validator function. Function should accept a dict value and return a validated version. Also recieves a context dictionary with additional validator context data like request, a basket object and basket_item in case validation is for bakset item.

property SALESMAN_ADMIN_REGISTER: bool

Set to False to skip Salesman admin registration, in case you wish to build your own ModelAdmin for Django or Wagtail.

SALESMAN_ADMIN_JSON_FORMATTER

A dotted path to JSON formatter function. Function should accept a dict value and return an HTML formatted string. Also recieves a context dictionary with additional render data.

property SALESMAN_ALLOW_ANONYMOUS_USER_CHECKOUT: bool

Set to False if you want to prevent to order if user not authorized.

conf.app_settings = <salesman.conf.AppSettings object>