Django-SHOP integration with django-currencies
Project description
Django-SHOP integration with django-currencies
Introduction
This module allows Django-SHOP implementations to integrate live currency feeds. This will allow you to offer your shop product prices in the user’s chosen currency. The module is currently compatible with Django v1.10.7 and Django-SHOP v0.10.2. This documentation assumes a working knowledge of Django and Django-SHOP.
TODO
Please let us know of you have any feature suggestions, or wish to implement any of the below:
Tests.
Continuous build integration including compatibility testing with various python, Django and Django-SHOP versions.
Configuration
Follow the Readme for django-currencies. Install this module through pip: pip install djangoshop-currencies.
The Django-SHOP Money system has been extended to use django-currencies as a currency conversion backend. To enable this functionality your currencies configuration must satisfy the following requirements:
ISO4217Exponent and symbol populating using manage.py currencies iso (This automatically imports the currencies set in the SHOP_CURRENCIES setting)
Currency factors populating using manage.py updatecurrencies <source> (This also sets the base currency to SHOP_DEFAULT_CURRENCY)
Some currencies set to active in the admin interface
Usage
Replace the DefaultCartModifier with the provided CurrencyCartModifier in your shop settings:
SHOP_CART_MODIFIERS = (
# provides the default cart lines
'shop_currencies.modifiers.CurrencyCartModifier',
...
Use the Money conversion extension which provides the to(code) function like so:
from django.db import models
from currencies.utils import get_currency_code
from shop_currencies.money.fields import MoneyField
class MyModel(models.Model):
unit_price = MoneyField()
...
def get_price(self, request):
session_currency_code = get_currency_code(request)
return self.unit_price.to(session_currency_code)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file djangoshop-currencies-0.1.0.tar.gz
.
File metadata
- Download URL: djangoshop-currencies-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9c4a69af462f2edab1d11f38b59f31be4dedc523fc2f42c2de2ad21a9e5c04c |
|
MD5 | f6cdb03042133ae786f414351b2d4351 |
|
BLAKE2b-256 | 92afc6dea7c08cc5f3a49a5ad2095372538db43d70d1d90b4ffe3d575e211e9f |