148 строки
3.8 KiB
Python
148 строки
3.8 KiB
Python
from decimal import Decimal
|
|
|
|
from market.models import Price, PriceCurrency
|
|
|
|
|
|
currencies = {
|
|
'CAD': {
|
|
'Tier 1': '0.99',
|
|
'Tier 2': '1.99',
|
|
'Tier 3': '2.99',
|
|
'Tier 4': '3.99',
|
|
'Tier 5': '4.99',
|
|
'Tier 6': '5.99',
|
|
'Tier 7': '6.99',
|
|
'Tier 8': '7.99',
|
|
'Tier 9': '8.99',
|
|
'Tier 10': '9.99',
|
|
'Tier 11': '10.99',
|
|
'Tier 12': '11.99',
|
|
'Tier 13': '12.99',
|
|
'Tier 14': '13.99',
|
|
'Tier 15': '14.99',
|
|
'Tier 16': '15.99',
|
|
'Tier 17': '16.99',
|
|
'Tier 18': '17.99',
|
|
'Tier 19': '18.99',
|
|
'Tier 20': '19.99',
|
|
'Tier 21': '20.99',
|
|
'Tier 22': '21.99',
|
|
'Tier 23': '22.99',
|
|
'Tier 24': '23.99',
|
|
'Tier 25': '24.99',
|
|
'Tier 26': '29.99',
|
|
'Tier 27': '34.99',
|
|
'Tier 28': '39.99',
|
|
'Tier 29': '44.99',
|
|
'Tier 30': '49.99',
|
|
},
|
|
'EUR': {
|
|
'Tier 1': '0.79',
|
|
'Tier 2': '1.49',
|
|
'Tier 3': '2.29',
|
|
'Tier 4': '2.99',
|
|
'Tier 5': '3.79',
|
|
'Tier 6': '4.49',
|
|
'Tier 7': '5.29',
|
|
'Tier 8': '5.99',
|
|
'Tier 9': '6.79',
|
|
'Tier 10': '7.49',
|
|
'Tier 11': '8.29',
|
|
'Tier 12': '8.99',
|
|
'Tier 13': '9.79',
|
|
'Tier 14': '10.49',
|
|
'Tier 15': '11.29',
|
|
'Tier 16': '11.99',
|
|
'Tier 17': '12.79',
|
|
'Tier 18': '13.49',
|
|
'Tier 19': '14.29',
|
|
'Tier 20': '14.99',
|
|
'Tier 21': '15.79',
|
|
'Tier 22': '16.49',
|
|
'Tier 23': '17.29',
|
|
'Tier 24': '17.99',
|
|
'Tier 25': '18.79',
|
|
'Tier 26': '22.29',
|
|
'Tier 27': '26.29',
|
|
'Tier 28': '29.99',
|
|
'Tier 29': '33.79',
|
|
'Tier 30': '37.29',
|
|
},
|
|
'GBP': {
|
|
'Tier 1': '0.69',
|
|
'Tier 2': '1.29',
|
|
'Tier 3': '1.99',
|
|
'Tier 4': '2.49',
|
|
'Tier 5': '3.29',
|
|
'Tier 6': '3.99',
|
|
'Tier 7': '4.49',
|
|
'Tier 8': '5.29',
|
|
'Tier 9': '5.99',
|
|
'Tier 10': '6.49',
|
|
'Tier 11': '6.99',
|
|
'Tier 12': '7.99',
|
|
'Tier 13': '8.29',
|
|
'Tier 14': '8.99',
|
|
'Tier 15': '9.49',
|
|
'Tier 16': '10.29',
|
|
'Tier 17': '10.99',
|
|
'Tier 18': '11.49',
|
|
'Tier 19': '11.99',
|
|
'Tier 20': '12.99',
|
|
'Tier 21': '13.49',
|
|
'Tier 22': '13.99',
|
|
'Tier 23': '14.99',
|
|
'Tier 24': '15.49',
|
|
'Tier 25': '15.99',
|
|
'Tier 26': '18.99',
|
|
'Tier 27': '22.49',
|
|
'Tier 28': '25.49',
|
|
'Tier 29': '28.49',
|
|
'Tier 30': '31.99',
|
|
},
|
|
'JPY': {
|
|
'Tier 1': '80',
|
|
'Tier 2': '160',
|
|
'Tier 3': '240',
|
|
'Tier 4': '320',
|
|
'Tier 5': '400',
|
|
'Tier 6': '460',
|
|
'Tier 7': '540',
|
|
'Tier 8': '620',
|
|
'Tier 9': '700',
|
|
'Tier 10': '780',
|
|
'Tier 11': '860',
|
|
'Tier 12': '940',
|
|
'Tier 13': '1000',
|
|
'Tier 14': '1080',
|
|
'Tier 15': '1160',
|
|
'Tier 16': '1240',
|
|
'Tier 17': '1320',
|
|
'Tier 18': '1400',
|
|
'Tier 19': '1480',
|
|
'Tier 20': '1560',
|
|
'Tier 21': '1620',
|
|
'Tier 22': '1700',
|
|
'Tier 23': '1780',
|
|
'Tier 24': '1860',
|
|
'Tier 25': '1940',
|
|
'Tier 26': '2320',
|
|
'Tier 27': '2700',
|
|
'Tier 28': '3100',
|
|
'Tier 29': '3480',
|
|
'Tier 30': '3860',
|
|
}
|
|
}
|
|
|
|
|
|
def run():
|
|
for currency, prices in currencies.items():
|
|
for k, v in prices.items():
|
|
try:
|
|
tier = Price.objects.get(name__localized_string=k)
|
|
PriceCurrency.objects.create(tier=tier,
|
|
price=Decimal(v),
|
|
currency=currency)
|
|
except Price.DoesNotExist:
|
|
print 'Skipping creating: %s, %s for %s' % (k, v, currency)
|