Management Command

About

This command is designed for use on regular busis with shedule management like cron.

Basicly it goes to Bank open api, parse rates (defined in settings) and stores result in database.

Command takes no external arguments.

Usage

Run this command in shell to update currencies

$ django-admin update_currency_rates

Helper functions

multi_currency.management.commands.update_currency_rates.fix_float_repr(tag)[source]

Replaces ”,” with ”.” so we can convert value to float.

Parameters:tag (xml.etree.ElementTree.Element) – xml tag that contains rate as string
Returns str:Fixed string
multi_currency.management.commands.update_currency_rates.get_rates(command)[source]

Main function that make call to external xml api.

Parameters:command (django.core.management.base.BaseCommand) – instance of current command

Parser makes 3 steps:

  1. Gets response from bank open api with urllib from standart library
  2. Uses xml.etree.ElementTree to parse this xml response.
  3. Stores result in multi_currency.models.Currency