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.DefaultSettings[source]¶
- property SALESMAN_PRODUCT_TYPES: dict¶
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'
.
- property SALESMAN_BASKET_MODIFIERS: list¶
A list of strings formated as
path.to.CustomModifier
. Modifiers must extendsalesman.basket.modifiers.BasketModifier
class. and define a uniqueidentifier
attribute.
- property SALESMAN_BASKET_ITEM_VALIDATOR: callable¶
A dotted path to basket item validator function.
- property SALESMAN_PAYMENT_METHODS: list¶
A list of strings formated as
path.to.CustomPayment
. Payments must extendsalesman.checkout.payment.PaymentMethod
class and define a uniqueidentifier
attribute.
- property SALESMAN_ORDER_STATUS: type¶
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 methodget_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 andvalidate_transition
method to validate status transitions.
- property SALESMAN_ORDER_REFERENCE_GENERATOR: callable¶
A dotted path to reference generator function for new orders. Function should accept a django request object as param:
request
.
- property SALESMAN_ORDER_SERIALIZER: type¶
A dotted path to a serializer class for Order.
- property SALESMAN_ORDER_SUMMARY_SERIALIZER: type¶
A dotted path to a summary serializer class for Order.
- property SALESMAN_PRICE_FORMATTER: callable¶
A dotted path to price formatter function. Function should accept a value of type:
Decimal
and return a price formatted string. Also recieves acontext
dictionary with additional render data likerequest
and either thebasket
ororder
object.
- property SALESMAN_ADDRESS_VALIDATOR: callable¶
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 likerequest
, abasket
object andaddress
type (set to either shipping or billing).
- property SALESMAN_EXTRA_VALIDATOR: callable¶
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 likerequest
, abasket
object andbasket_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 ownModelAdmin
for Django or Wagtail.
- property SALESMAN_ADMIN_CUSTOMER_FORMATTER: callable¶
A dotted path to Customer formatter function. Function should accept user as argument and return a string for customer display. Also recieves a
context
dictionary with additional render data.
- property SALESMAN_ADMIN_JSON_FORMATTER: callable¶
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.
- conf.app_settings = <salesman.conf.DefaultSettings object>¶