Maximizing Django Oscar Settings Variables

Infinite Cipher
Python in Plain English
2 min readApr 26, 2020

--

Thanks to Unsplash for the wonderful image.

Let me share with you some Django Oscar settings variable that is rarely used but are useful.

OSCAR_FROM_EMAIL

After setting up your Oscar project you will notice that some of the emails sent out are under “oscar@example.com” which makes you think why? I already changed my “DEFAULT_FROM_EMAIL” to “Infinite Cipher <no-reply@infinitecipher.com>”. So to fix that just set “OSCAR_FROM_EMAIL=DEFAULT_FROM_EMAILunder settings.py.

OSCAR_ORDER_STATUS_CASCADE

OSCAR_ORDER_STATUS_CASCADE = {
'Being processed': 'In progress'
}

This setting is useful when you have different statuses for the Order level and Order line level. For example, an order was placed with status “New”. Then from the dashboard admin changed it to “Being processed” your order line status will be changed to whatever value on “OSCAR_ORDER_STATUS_CASCADE” in our case it will change to “In progress”.

OSCAR_ALLOW_ANON_CHECKOUT

It defaults to “False” if “True” you’re allowing an anonymous user to check out on the shop.

OSCAR_DEFAULT_CURRENCY and OSCAR_CURRENCY_FORMAT

Since you have a shop now you must decide with default currency to use in the app. “OSCAR_DEFAULT_CURRENCY” does the job for you by just setting like “OSCAR_DEFAULT_CURRENCY = KWD”. Now you may wonder how about the display of proper decimal places, that’s where we use “OSCAR_CURRENCY_FORMAT”.

OSCAR_CURRENCY_FORMAT = {
'KWD': {
'currency_digits': False,
'format_type': "accounting",
'format': u'¤\xa0#,##0.000',
},
}

Let’s just break down the code above.

'currency_digits': False, Use the currency’s natural number of decimal digits. Defaults to True. So if you want to provide your custom decimal digits set this to False'format_type': "accounting",The currency format type to use.'format': u'¤\xa0#,##0.000',The format string to use. So you can customize this to any decimal places you want.

To learn more about Currency formatting please follow and read the link below.

AUTH_PROFILE_MODULE

This is a legacy setting of Oscar but still works. This is really helpful if your app has an extended model for your User model. The views and forms for editing user profiles in Oscar are already linked to this. All you need to do is map what application model to used like.

AUTH_PROFILE_MODULE = "customaccount.Profile"

If you wanna know more about Django Oscar settings follow this link for your reference.

Also for your reference my code is available at

If you have any suggestions and comments please hit the button below. I will do my best to answer and help you with your concerns. Thank you.

--

--