Skip to main content
=================================
django SHOP - Multiple Currencies
=================================

This app adds support for multiple currencies to django SHOP.

Warning
=======

Do not use (yet)!
This app is still under development and might not work at all.

Installation
============

This requires django SHOP to work (https://github.com/chrisglass/django-shop)

* Add `shop_multiplecurrencies` to your INSTALLED_APPS in your settings.py
* Add `shop_multiplecurrencies.middleware.MultipleCurrenciesMiddleware` to your
`MIDDLEWARE_CLASSES` setting
* Add a list of currencies to the `SHOP_CURRENCIES` setting like so

::

SHOP_CURRENCIES=[ # lowercase codes, please
['chf', 'swiss franc'],
['eur', 'euro'],
]

Usage
=====

* Add a MultipleCurrenciesField to your product model

::

from django.db import models
from shop_multiplecurrencies.fields import MultipleCurrenciesField
from shop.util.fields import CurrencyField

class MyProduct(models.Model):
# my fields ...
price = MultipleCurrenciesField(CurrencyField)

The model will in our example have two fields: `price_chf` and `price_eur`.

* Extend BaseOrder with an additional field that tells us which currency the order was completed in

::

from django.conf import settings
from shop.models.defaults.bases import BaseOrder
from shop.models.defaults.managers import OrderManager

class MyOrder(BaseOrder):
currency = models.CharField(max_length=6, choices=settings.SHOP_CURRENCIES)
objects = OrderManager()

def save(self, *args, **kwargs):
self.currency = get_currency()
super(MyOrder, self).save(*args, **kwargs)

class Meta(object):
abstract = False

* Use the currency template filter in your templates to prefix the price with the correct currency

::

{% load currency %}

<p>This product's price is {{ price|currency }}</p>

Metadata

Release files for django-shop-multiplecurrencies 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-shop-multiplecurrencies 1.0.0
File Size Uploaded Provenance
django-shop-multiplecurrencies-1.0.0.tar.gz 3.0 kB Without provenance Details

Release files / django-shop-multiplecurrencies-1.0.0.tar.gz

Download URL django-shop-multiplecurrencies-1.0.0.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
979a0745255149ef36c783f33881a2bebf99839354427766971809316ab79ede
BLAKE2b-256 checksum
How to use checksums
2839158cf0aa3468e8f6013fba3b6765329303db856594a68127df0ef443675b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-shop-multiplecurrencies 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page