parent
3a119728b0
commit
4929c78e47
15 changed files with 275 additions and 17 deletions
@ -0,0 +1,7 @@ |
|||||||
|
#!/usr/bin/env python |
||||||
|
# -*- coding: utf-8 -*- |
||||||
|
from store.currency import Currency |
||||||
|
|
||||||
|
|
||||||
|
def currency(request): |
||||||
|
return Currency(request) |
||||||
File diff suppressed because one or more lines are too long
@ -1,8 +0,0 @@ |
|||||||
@brand-roballen: #027BC1; |
|
||||||
@brand-roballen-second: #A4A5A9; |
|
||||||
|
|
||||||
.navbar-item__roballen { |
|
||||||
background: @brand-roballen; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,71 @@ |
|||||||
|
@brand-roballen: #027BC1; |
||||||
|
@brand-roballen-second: #A4A5A9; |
||||||
|
|
||||||
|
.navbar-item__roballen { |
||||||
|
background: @brand-roballen; |
||||||
|
} |
||||||
|
|
||||||
|
.open .navbar-item__currency { |
||||||
|
//color: #fed000 !important; |
||||||
|
} |
||||||
|
|
||||||
|
.navbar-item__currency { |
||||||
|
float: left; |
||||||
|
height: 50px; |
||||||
|
font-size: 14px!important; |
||||||
|
width: 34px; |
||||||
|
|
||||||
|
&:after { |
||||||
|
clear: both; |
||||||
|
display: table; |
||||||
|
content: " "; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.open .currency-icon { |
||||||
|
background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%); |
||||||
|
background-repeat: repeat-x; |
||||||
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0); |
||||||
|
box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25); |
||||||
|
} |
||||||
|
|
||||||
|
.currency-icon { |
||||||
|
display: block; |
||||||
|
margin-left: 0; |
||||||
|
width: 49px; |
||||||
|
text-align: center; |
||||||
|
line-height: 50px; |
||||||
|
} |
||||||
|
|
||||||
|
.currency-menu { |
||||||
|
width: 50px; |
||||||
|
left: inherit!important; |
||||||
|
margin: 0; |
||||||
|
position: absolute; |
||||||
|
float: left; |
||||||
|
background-color: #434a54; |
||||||
|
color: #fff; |
||||||
|
border-width: 0 1px 1px; |
||||||
|
border-radius: 0 0 2px 2px; |
||||||
|
box-shadow: 0 6px 12px rgba(0,0,0,.175); |
||||||
|
|
||||||
|
& .yamm-content { |
||||||
|
padding: 10px; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
.currency-item { |
||||||
|
&:last-child { |
||||||
|
margin-bottom: 0; |
||||||
|
} |
||||||
|
margin-bottom:15px; |
||||||
|
text-align: center; |
||||||
|
} |
||||||
|
|
||||||
|
.currency-item__link { |
||||||
|
display: block; |
||||||
|
padding: 0!important; |
||||||
|
border: 0!important; |
||||||
|
font-size: 14px!important; |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
#!/usr/bin/env python |
||||||
|
# -*- coding: utf-8 -*- |
||||||
|
from .models import Currency as CurrencyModel |
||||||
|
|
||||||
|
MAIN_CURRENCY_ID = '1' |
||||||
|
|
||||||
|
|
||||||
|
class Currency(object): |
||||||
|
currency_id = '' |
||||||
|
|
||||||
|
def __init__(self, request): |
||||||
|
self.cart_id = request.session.get('currency_id', None) |
||||||
|
if not self.currency_id: |
||||||
|
self.currency_id = MAIN_CURRENCY_ID |
||||||
|
request.session['currency_id'] = MAIN_CURRENCY_ID |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,30 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
# Generated by Django 1.9.3 on 2017-03-06 18:23 |
||||||
|
from __future__ import unicode_literals |
||||||
|
|
||||||
|
from django.db import migrations, models |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('store', '0055_auto_20170224_1244'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.CreateModel( |
||||||
|
name='Currency', |
||||||
|
fields=[ |
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||||
|
('title', models.CharField(max_length=25, verbose_name='Название')), |
||||||
|
('exchange', models.FloatField(verbose_name='Курс, KZT/ед.')), |
||||||
|
('abridgement', models.CharField(max_length=25, verbose_name='Сокращенное название')), |
||||||
|
('ISO_letter_code', models.CharField(help_text='Например: KZT, USD, RUB', max_length=3, verbose_name='Буквенный код')), |
||||||
|
('HTML_letter_code', models.CharField(help_text='Код в HTML для вывода в шаблонах', max_length=10, verbose_name='HTML код')), |
||||||
|
], |
||||||
|
options={ |
||||||
|
'verbose_name': 'валюта', |
||||||
|
'verbose_name_plural': 'валюты', |
||||||
|
}, |
||||||
|
) |
||||||
|
] |
||||||
@ -0,0 +1,35 @@ |
|||||||
|
# -*- coding: utf-8 -*- |
||||||
|
from __future__ import unicode_literals |
||||||
|
|
||||||
|
from django.db import migrations |
||||||
|
|
||||||
|
|
||||||
|
def create_currency(apps, schema_editor): |
||||||
|
Currency = apps.get_model("store", "Currency") |
||||||
|
Currency.objects.get_or_create(title="Казахстанский тенге", |
||||||
|
exchange=1.00, |
||||||
|
abridgement="тенге", |
||||||
|
ISO_letter_code="KZT", |
||||||
|
HTML_letter_code="₸") |
||||||
|
Currency.objects.get_or_create(title="Российский рубль", |
||||||
|
exchange=0.18519, |
||||||
|
abridgement="руб.", |
||||||
|
ISO_letter_code="RUB", |
||||||
|
HTML_letter_code="₽") |
||||||
|
Currency.objects.get_or_create(title="Доллар США", |
||||||
|
exchange=0.00315, |
||||||
|
abridgement="доллар", |
||||||
|
ISO_letter_code="USD", |
||||||
|
HTML_letter_code="$") |
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration): |
||||||
|
|
||||||
|
dependencies = [ |
||||||
|
('store', '0056_auto_20170306_1823'), |
||||||
|
] |
||||||
|
|
||||||
|
operations = [ |
||||||
|
migrations.RunPython(create_currency) |
||||||
|
] |
||||||
|
|
||||||
Loading…
Reference in new issue