作为django应用程序添加对多种货币的支持。
django-currencies的Python项目详细描述
Django货币图片::https://travis-ci.org/panosl/django-currences.svg?branch=master
:目标:https://travis ci.org/panosl/django currences
。图片::https://codecov.io/gh/panosl/django currences/branch/master/graph/badge.svg
:目标:https://codecov.io/gh/panosl/django currences
django currences允许您定义不同的货币,
包括模板标记/过滤器,以便在它们之间进行轻松转换。
有关更多详细信息,请参阅"文档"中的"文档"
作者是"panos laganakos<;http://panoslaganakos.com/>;`,还有一些很棒的
`contributors<;https://github.com/panosl/django currences/contributors>;`.
installation
----
1。将此存储库克隆到项目中,或使用"pip"安装:
…代码块::shell
2。您需要将"货币"添加到项目设置文件中的"已安装的应用程序"中:
…代码块::python
)
3A.或者使用"货币.上下文\处理器.货币"处理器:
…代码块::python
代码块:html+django
{%load currency%}
{%currency_context%}
4。更新"url.py"文件:
…代码块::python
url patterns+=模式('',
url(r'^currences/',include('currences.url'),
)
然后运行`./manage.py migrate``以创建所需的数据库表
在这种情况下,需要应用一个伪迁移
:
…代码块::shell
./manage.py migrate currences 0001--fake
http://finance.yahoo.com/currency converter/>;``和
`currency iso<;http://www.currency-iso.org/>;``管理命令**
**您可以使用管理命令``currences``和``updatecurrencies`
来维护数据库中的货币。前者会将选定源上定义的所有
货币导入数据库。
这包括货币代码、名称、符号等信息,以及提供的任何
其他信息。后者将从源更新所有数据库货币
汇率。源中缺少的任何货币都将保持不变。
代码块::shell
./manage.py currences--import=usd--import=eur
./manage.py currences--i shop-currences
如果未指定"-i",命令将在设置中自动查找变量currences或shop-currences
。
有关附加开关`--force``和`--verbosity`
try`./manage.py help currences`。
``updatecurrences``可以通过指定e``--base``这样开关:
…代码块::shell
./manage.py updatecurrencies oxr--base=USD
./manage.py updatecurrencies yahoo-b shop_default_currency
如果"b"不是,则该命令会在设置中自动查找变量currency_base或shop_default_currency
指定的。
**openexchangerates**
这是默认源,或者使用"oxr"作为
任一命令的位置参数来选择它。
代码块::python
openexchangerates_app_id="c2b2efcb306e075d9c2f2d0b614119ea"
要求:`requests<;http://docs.python requests.org/en/master/>;``u
(python3兼容fork of`openexchangeratesclient<;https://github.com/metglobal/openexchangerates>;`
由于放弃的项目而整合)
**雅虎金融**
…注意:
但是,缓存的货币json文件将继续通过"货币"命令可用。
`` yahoo``作为位置参数。
要求:`beautifulsoup4<;https://www.crummy.com/software/beautifulsoup/bs4/doc/>;`u
和`requests<;http://docs.python requests.org/en/master/>;`u
**currency iso**
参数。
要求:`requests<;http://docs.python requests.org/en/master/>;` ` `
=========================================
集成实时feeds
----=================================================================货币汇率符号其他信息
=================================================================================================================================================================================================br/>国际标准化组织|| t
=======================================
…| T Unicode::U+2705..勾选
…| s s原始::html
<;s>;
…| se raw::html
<;/s>;
\以及可选的货币名称。
用法
----
首先,在每个要使用的模板中加载"currency":
代码块:html+django
{%load currency%}
使用:
…代码块::html+django
{%更改货币[价格][货币代码]]}
例如:
…代码块:html+django
{%change_currency product.price"USD"%}
<;!--或者,如果有"currency.context\u processors.currency"可用-->;
{%change\currency product.price currency.code%}
代码块::html+django
{{[price]货币:[currency\u code]}
例如:
……代码块:html+django
{product.price{currency:"USD"}
代码块:html+django
{%url'currency\u set\u currency'[currency\u code]]}
或者使用模板标记"currency\u context`:
代码块:html+django
{%currency_context%}
,它给出了三个上下文变量:``currences``,``currency_code``和``currency``。
**包含的模板**
是一个用于引导3&fontawesome兼容navbar currency的模板
chooser。如果有1种以上的现行货币,将显示NavBar项。
存在NAvbar参数"dropdown_extra_class",用于向下拉列表提供额外的类
:
。代码块:html+django
{%block navbar nav%}
…
<;ul class="nav navbar nav bar right">;
…
{%带下拉菜单"extra_class="collapsed nav"%}
{%包含"货币/navbar/currency-chooser-bs3fa.html"%}
{%endwith%}
注意:
未重新生成。
:目标:https://travis ci.org/panosl/django currences
。图片::https://codecov.io/gh/panosl/django currences/branch/master/graph/badge.svg
:目标:https://codecov.io/gh/panosl/django currences
django currences允许您定义不同的货币,
包括模板标记/过滤器,以便在它们之间进行轻松转换。
有关更多详细信息,请参阅"文档"中的"文档"
作者是"panos laganakos<;http://panoslaganakos.com/>;`,还有一些很棒的
`contributors<;https://github.com/panosl/django currences/contributors>;`.
installation
----
1。将此存储库克隆到项目中,或使用"pip"安装:
…代码块::shell
2。您需要将"货币"添加到项目设置文件中的"已安装的应用程序"中:
…代码块::python
)
3A.或者使用"货币.上下文\处理器.货币"处理器:
…代码块::python
代码块:html+django
{%load currency%}
{%currency_context%}
4。更新"url.py"文件:
…代码块::python
url patterns+=模式('',
url(r'^currences/',include('currences.url'),
)
然后运行`./manage.py migrate``以创建所需的数据库表
在这种情况下,需要应用一个伪迁移
:
…代码块::shell
./manage.py migrate currences 0001--fake
http://finance.yahoo.com/currency converter/>;``和
`currency iso<;http://www.currency-iso.org/>;``管理命令**
**您可以使用管理命令``currences``和``updatecurrencies`
来维护数据库中的货币。前者会将选定源上定义的所有
货币导入数据库。
这包括货币代码、名称、符号等信息,以及提供的任何
其他信息。后者将从源更新所有数据库货币
汇率。源中缺少的任何货币都将保持不变。
代码块::shell
./manage.py currences--import=usd--import=eur
./manage.py currences--i shop-currences
如果未指定"-i",命令将在设置中自动查找变量currences或shop-currences
。
有关附加开关`--force``和`--verbosity`
try`./manage.py help currences`。
``updatecurrences``可以通过指定e``--base``这样开关:
…代码块::shell
./manage.py updatecurrencies oxr--base=USD
./manage.py updatecurrencies yahoo-b shop_default_currency
如果"b"不是,则该命令会在设置中自动查找变量currency_base或shop_default_currency
指定的。
**openexchangerates**
这是默认源,或者使用"oxr"作为
任一命令的位置参数来选择它。
代码块::python
openexchangerates_app_id="c2b2efcb306e075d9c2f2d0b614119ea"
要求:`requests<;http://docs.python requests.org/en/master/>;``u
(python3兼容fork of`openexchangeratesclient<;https://github.com/metglobal/openexchangerates>;`
由于放弃的项目而整合)
**雅虎金融**
…注意:
`` yahoo``作为位置参数。
要求:`beautifulsoup4<;https://www.crummy.com/software/beautifulsoup/bs4/doc/>;`u
和`requests<;http://docs.python requests.org/en/master/>;`u
**currency iso**
参数。
要求:`requests<;http://docs.python requests.org/en/master/>;` ` `
=========================================
集成实时feeds
----=================================================================货币汇率符号其他信息
=================================================================================================================================================================================================br/>国际标准化组织|| t
=======================================
…| T Unicode::U+2705..勾选
…| s s原始::html
<;s>;
…| se raw::html
<;/s>;
\以及可选的货币名称。
用法
----
首先,在每个要使用的模板中加载"currency":
代码块:html+django
{%load currency%}
使用:
…代码块::html+django
{%更改货币[价格][货币代码]]}
例如:
…代码块:html+django
{%change_currency product.price"USD"%}
<;!--或者,如果有"currency.context\u processors.currency"可用-->;
{%change\currency product.price currency.code%}
代码块::html+django
{{[price]货币:[currency\u code]}
例如:
……代码块:html+django
{product.price{currency:"USD"}
代码块:html+django
{%url'currency\u set\u currency'[currency\u code]]}
或者使用模板标记"currency\u context`:
代码块:html+django
{%currency_context%}
,它给出了三个上下文变量:``currences``,``currency_code``和``currency``。
**包含的模板**
是一个用于引导3&fontawesome兼容navbar currency的模板
chooser。如果有1种以上的现行货币,将显示NavBar项。
存在NAvbar参数"dropdown_extra_class",用于向下拉列表提供额外的类
:
。代码块:html+django
{%block navbar nav%}
…
<;ul class="nav navbar nav bar right">;
…
{%带下拉菜单"extra_class="collapsed nav"%}
{%包含"货币/navbar/currency-chooser-bs3fa.html"%}
{%endwith%}
注意:
未重新生成。