Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
6ebf4368
Commit
6ebf4368
authored
Sep 01, 2018
by
Florent Chehab
Browse files
Merge branch 'currency_update' into 'master'
Currency update See merge request chehabfl/outgoing_rex!23
parents
f1d6cc0c
6da61da5
Pipeline
#26847
passed with stages
in 2 minutes and 23 seconds
Changes
12
Pipelines
1
Show whitespace changes
Inline
Side-by-side
backend/generate/api_config.yml
View file @
6ebf4368
...
...
@@ -39,7 +39,7 @@
-
model
:
Currency
viewset
:
CurrencyViewSet
import_location
:
module
import_location
:
location
api_end_point
:
currency
-
model
:
Department
...
...
backend/load_data/assets/currencies.csv
0 → 100644
View file @
6ebf4368
"code","name","rate_in_eur"
"AED","Dirham des Émirats arabes unis",4.26881
"AFN","Afghani afghan",85.397605
"ALL","Lek albanais",126.663068
"AMD","Dram arménien",561.399696
"ANG","Florin néerlandais",2.145153
"AOA","Kwanza angolais",321.087195
"ARS","Peso argentin",42.815935
"AUD","Dollar australien",1.616089
"AWG","Florin arubais ou néerlandais",2.083152
"AZN","Manat azerbaïdjanais",1.978563
"BAM","Mark convertible de Bosnie-Herzégovine",1.85258
"BBD","Dollar de la Barbade",2.327726
"BDT","Taka bangladais",97.436929
"BGN","Lev bulgare",1.958458
"BHD","Dinar bahreïni",0.438287
"BIF","Franc burundais",2058.281763
"BMD","Dollar bermudien",1.162149
"BND","Dollar du Brunei",1.755931
"BOB","Bolíviano bolivien",8.062931
"BRL","Réal brésilien",4.713099
"BSD","Dollar bahaméen",1.162556
"BTC","Bitcoin",0.000165
"BTN","Ngultrum du Bhoutan",82.299254
"BWP","Pula du Botswana",12.502444
"BYN","Rouble biélorusse",2.423952
"BYR","Rouble biélorusse",22778.116738
"BZD","Dollar bélizien",2.337024
"CAD","Dollar canadien",1.516314
"CDF","Franc congolais",1878.032903
"CHF","Franc suisse",1.126105
"CLF","Unidad de Fomento",0.026269
"CLP","Peso chilien",792.125178
"CNY","Yuan ou renminbi chinois",7.937936
"COP","Peso colombien",3568.552253
"CRC","Colon costaricain",664.929301
"CUC","Peso cubain convertible",1.162149
"CUP","Peso cubain",30.796944
"CVE","Escudo cap-verdien",109.877108
"CZK","Couronne tchèque",25.807146
"DJF","Franc de Djibouti",206.537545
"DKK","Couronne danoise",7.468015
"DOP","Peso dominicain",58.20627
"DZD","Dinar algérien",137.110774
"EGP","Livre égyptienne",20.683348
"ERN","Nakfa érythréen",17.432648
"ETB","Birr éthiopien",32.127028
"EUR","Euro",1
"FJD","Dollar de Fidji",2.45289
"FKP","Livre des Îles Malouines",0.894843
"GBP","Livre britannique",0.89665
"GEL","Lari géorgien",2.894205
"GGP","Livre de Guernesey",0.897011
"GHS","Cédi ghanéen",5.514982
"GIP","Livre de Gibraltar",0.894843
"GMD","Dalasi gambien",55.823865
"GNF","Franc guinéen",10516.924245
"GTQ","Quetzal guatémaltèque",8.789801
"GYD","Dollar guyanien",244.103594
"HKD","Dollar de Hong Kong",9.122229
"HNL","Lempira hondurien",27.910752
"HRK","Kuna croate",7.450076
"HTG","Gourde haïtienne",80.236502
"HUF","Forint hongrois",327.191828
"IDR","Roupie indonésienne",17154.478631
"ILS","Shekel israélien",4.187746
"IMP","Livre mannoise",0.897011
"INR","Roupie indienne",82.361936
"IQD","Dinar irakien",1387.373253
"IRR","Rial iranien",48932.276188
"ISK","Couronne islandaise",125.105768
"JEP","Livre de Jersey",0.897011
"JMD","Dollar jamaïcain",158.726733
"JOD","Dinar jordanien",0.824549
"JPY","Yen japonais",129.045452
"KES","Shilling kényan",117.00559
"KGS","Som du Kirghizistan",80.216048
"KHR","Riel cambodgien",4757.028152
"KMF","Franc comorien",495.180434
"KPW","Won nord-coréen",1045.671786
"KRW","Won sud-coréen",1296.540148
"KWD","Dinar koweïtien",0.351876
"KYD","Dollar des îles Caïmans",0.968888
"KZT","Tenge kazakh",422.778562
"LAK","Kip laotien",9903.604151
"LBP","Livre libanaise",1760.830219
"LKR","Roupie sri lankaise",187.675856
"LRD","Dollar libérien",179.261898
"LSL","Loti du Lesotho",16.554855
"LTL","Litas lituanien",3.543048
"LVL","Lats letton",0.721172
"LYD","Dinar libyen",1.602313
"MAD","Dirham marocain",10.966854
"MDL","Leu moldave",19.484011
"MGA","Ariary malgache",3877.568064
"MKD","Dinar macédonien",61.652436
"MMK","Kyat du Myanmar",1764.37869
"MNT","Tugrik mongol",2857.833389
"MOP","Pataca de Macao",9.399505
"MRO","Ouguiya mauritanien",415.366235
"MUR","Roupie mauricienne",39.914587
"MVR","Rufiyaa maldivien",17.96726
"MWK","Kwacha malawien",845.254514
"MXN","Peso mexicain",22.179034
"MYR","Ringgit malais",4.784612
"MZN","Metical mozambicain",69.630191
"NAD","Dollar namibien",16.75242
"NGN","Naira nigérian",420.895874
"NIO","Cordoba nicaraguayen",37.130078
"NOK","Couronne norvégienne",9.747295
"NPR","Roupie népalaise",131.927571
"NZD","Dollar néo-zélandais",1.756298
"OMR","Rial omanais",0.447329
"PAB","Balboa panaméen",1.162439
"PEN","Sol péruvien",3.841077
"PGK","Kina de Papouasie-Nouvelle-Guinée",3.779483
"PHP","Piso philippin",62.250546
"PKR","Roupie pakistanaise",142.933118
"PLN","Zloty polonais",4.310066
"PYG","Guarani paraguayen",6800.256108
"QAR","Rial qatari",4.231428
"RON","Leu roumain",4.647786
"RSD","Dinar serbe",118.446641
"RUB","Rouble russe",78.463684
"RWF","Franc rwandais",1023.696214
"SAR","Rial saoudien",4.357365
"SBD","Dollar des îles Salomon",9.201372
"SCR","Roupie seychelloise",15.816269
"SDG","Livre soudanaise",21.005263
"SEK","Couronne suédoise",10.630761
"SGD","Dollar de Singapour",1.594589
"SHP","Livre de Sainte-Hélène",1.535087
"SLL","Leone de Sierra Leone",10110.695068
"SOS","Shilling somalien",671.145201
"SRD","Dollar du Surinam",8.66735
"STD","Dobra de Sao Tomé",24571.976213
"SVC","Colon salvadorien",10.173223
"SYP","Livre syrienne",598.507031
"SZL","Lilangeni du Swaziland",17.092308
"THB","Baht thaïlandais",38.022067
"TJS","Somoni tadjik",10.956279
"TMT","Manat turkmène",4.073332
"TND","Dinar tunisien",3.209162
"TOP","Pa’anga de Tonga",2.655801
"TRY","Livre turque",7.606501
"TTD","Dollar de Trinidad",7.836312
"TWD","Nouveau dollar de Taïwan",35.659418
"TZS","Shilling tanzanien",2658.30342
"UAH","Hryvnia ukrainienne",32.842753
"UGX","Shilling ougandais",4374.448567
"USD","Dollar des États-Unis",1.162149
"UYU","Peso uruguayen",37.224053
"UZS","Som ouzbek",9100.442923
"VEF","Bolivar vénézuélien",288817.165364
"VND","Dong vietnamien",27094.33743
"VUV","Vatu vanuatais",129.004904
"WST","Tala de Samoa",3.070819
"XAF","Franc CFA d’Afrique centrale",653.732375
"XAG","Once d’argent",0.079966
"XAU","Once d’or",0.000968
"XCD","Dollar des Caraïbes orientales",3.140766
"XDR","Droits de tirage spéciaux du FMI",0.829283
"XOF","Franc CFA",653.720752
"XPF","Franc CFP",118.853382
"YER","Rial yéménite",290.944378
"ZAR","Rand sud-africain",17.069065
"ZMK","Kwacha zambien (obsolète)",10460.738073
"ZMW","Kwacha zambien",11.986988
"ZWL","Dollar du Zimbabwe",374.624493
backend/load_data/load_all.py
View file @
6ebf4368
from
.loading_scripts
import
LoadAdminUser
from
.loading_scripts
import
LoadCurrencies
from
.loading_scripts
import
LoadCountries
from
.loading_scripts
import
LoadUniversities
from
.loading_scripts
import
LoadTags
...
...
@@ -6,6 +7,7 @@ from .loading_scripts import LoadTags
def
load_all
():
admin
=
LoadAdminUser
().
get
()
LoadCurrencies
(
admin
).
load
()
LoadCountries
(
admin
).
load
()
LoadUniversities
(
admin
).
load
()
LoadTags
(
admin
).
load
()
backend/load_data/loading_scripts/__init__.py
View file @
6ebf4368
...
...
@@ -2,3 +2,4 @@ from .loadAdminUser import LoadAdminUser # noqa: F401
from
.loadCountries
import
LoadCountries
# noqa: F401
from
.loadUniversities
import
LoadUniversities
# noqa: F401
from
.loadTags
import
LoadTags
# noqa: F401
from
.loadCurrencies
import
LoadCurrencies
# noqa: F401
backend/load_data/loading_scripts/loadCurrencies.py
0 → 100644
View file @
6ebf4368
from
backend.models.location
import
Currency
import
os
import
csv
from
.loadGeneric
import
LoadGeneric
from
decimal
import
Decimal
class
LoadCurrencies
(
LoadGeneric
):
def
__init__
(
self
,
admin
):
self
.
admin
=
admin
def
load
(
self
):
tmp
=
os
.
path
.
join
(
os
.
path
.
realpath
(
__file__
),
'../../assets/currencies.csv'
)
currencies_file_loc
=
os
.
path
.
abspath
(
tmp
)
with
open
(
currencies_file_loc
)
as
csvfile
:
reader
=
csv
.
reader
(
csvfile
,
quotechar
=
'"'
)
next
(
reader
)
for
r
in
reader
:
currency
=
Currency
(
code
=
r
[
0
],
name
=
r
[
1
],
symbol
=
""
,
one_EUR_in_this_currency
=
Decimal
(
r
[
2
])
)
currency
.
save
()
self
.
add_info
(
currency
,
self
.
admin
)
backend/migrations/0001_initial.py
View file @
6ebf4368
# Generated by Django 2.0.3 on 2018-0
8-30 20:53
# Generated by Django 2.0.3 on 2018-0
9-01 13:18
import
backend.utils.friendly_path
from
django.conf
import
settings
...
...
@@ -99,10 +99,10 @@ class Migration(migrations.Migration):
fields
=
[
(
'moderated_on'
,
models
.
DateTimeField
(
null
=
True
)),
(
'updated_on'
,
models
.
DateTimeField
(
null
=
True
)),
(
'code'
,
models
.
CharField
(
max_length
=
15
,
primary_key
=
True
,
serialize
=
False
)),
(
'code'
,
models
.
CharField
(
max_length
=
3
,
primary_key
=
True
,
serialize
=
False
)),
(
'name'
,
models
.
CharField
(
max_length
=
100
)),
(
'symbol'
,
models
.
CharField
(
max_length
=
5
)),
(
'one_
USD
_in_this_currency'
,
models
.
DecimalField
(
decimal_places
=
6
,
max_digits
=
20
,
validators
=
[
django
.
core
.
validators
.
MinValueValidator
(
0
)])),
(
'symbol'
,
models
.
CharField
(
blank
=
True
,
max_length
=
30
,
null
=
True
)),
(
'one_
EUR
_in_this_currency'
,
models
.
DecimalField
(
decimal_places
=
6
,
max_digits
=
20
,
validators
=
[
django
.
core
.
validators
.
MinValueValidator
(
0
)])),
(
'moderated_by'
,
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
SET_NULL
,
related_name
=
'+'
,
to
=
settings
.
AUTH_USER_MODEL
)),
(
'updated_by'
,
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
SET_NULL
,
related_name
=
'+'
,
to
=
settings
.
AUTH_USER_MODEL
)),
],
...
...
@@ -352,6 +352,7 @@ class Migration(migrations.Migration):
fields
=
[
(
'moderated_on'
,
models
.
DateTimeField
(
null
=
True
)),
(
'updated_on'
,
models
.
DateTimeField
(
null
=
True
)),
(
'custom_content'
,
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
)),
(
'campus'
,
models
.
OneToOneField
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
primary_key
=
True
,
related_name
=
'city_items'
,
serialize
=
False
,
to
=
'backend.Campus'
)),
(
'moderated_by'
,
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
SET_NULL
,
related_name
=
'+'
,
to
=
settings
.
AUTH_USER_MODEL
)),
(
'tag'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
related_name
=
'+'
,
to
=
'backend.Tag'
)),
...
...
@@ -363,6 +364,7 @@ class Migration(migrations.Migration):
fields
=
[
(
'moderated_on'
,
models
.
DateTimeField
(
null
=
True
)),
(
'updated_on'
,
models
.
DateTimeField
(
null
=
True
)),
(
'custom_content'
,
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
)),
(
'city'
,
models
.
OneToOneField
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
primary_key
=
True
,
related_name
=
'city_items'
,
serialize
=
False
,
to
=
'backend.City'
)),
(
'moderated_by'
,
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
SET_NULL
,
related_name
=
'+'
,
to
=
settings
.
AUTH_USER_MODEL
)),
(
'tag'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
related_name
=
'+'
,
to
=
'backend.Tag'
)),
...
...
@@ -374,6 +376,7 @@ class Migration(migrations.Migration):
fields
=
[
(
'moderated_on'
,
models
.
DateTimeField
(
null
=
True
)),
(
'updated_on'
,
models
.
DateTimeField
(
null
=
True
)),
(
'custom_content'
,
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
)),
(
'country'
,
models
.
OneToOneField
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
primary_key
=
True
,
related_name
=
'country_items'
,
serialize
=
False
,
to
=
'backend.Country'
)),
(
'moderated_by'
,
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
SET_NULL
,
related_name
=
'+'
,
to
=
settings
.
AUTH_USER_MODEL
)),
(
'tag'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
related_name
=
'+'
,
to
=
'backend.Tag'
)),
...
...
@@ -422,6 +425,7 @@ class Migration(migrations.Migration):
fields
=
[
(
'moderated_on'
,
models
.
DateTimeField
(
null
=
True
)),
(
'updated_on'
,
models
.
DateTimeField
(
null
=
True
)),
(
'custom_content'
,
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
)),
(
'university'
,
models
.
OneToOneField
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
primary_key
=
True
,
related_name
=
'city_items'
,
serialize
=
False
,
to
=
'backend.University'
)),
(
'moderated_by'
,
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
SET_NULL
,
related_name
=
'+'
,
to
=
settings
.
AUTH_USER_MODEL
)),
(
'tag'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
related_name
=
'+'
,
to
=
'backend.Tag'
)),
...
...
backend/migrations/0002_auto_20180901_1000.py
deleted
100644 → 0
View file @
f1d6cc0c
# Generated by Django 2.0.3 on 2018-09-01 08:00
import
django.contrib.postgres.fields.jsonb
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'backend'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'campustaggeditem'
,
name
=
'custom_content'
,
field
=
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
),
),
migrations
.
AddField
(
model_name
=
'citytaggeditem'
,
name
=
'custom_content'
,
field
=
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
),
),
migrations
.
AddField
(
model_name
=
'countrytaggeditem'
,
name
=
'custom_content'
,
field
=
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
),
),
migrations
.
AddField
(
model_name
=
'universitytaggeditem'
,
name
=
'custom_content'
,
field
=
django
.
contrib
.
postgres
.
fields
.
jsonb
.
JSONField
(
default
=
dict
),
),
]
backend/models/location/__init__.py
View file @
6ebf4368
from
.currency
import
Currency
,
CurrencyViewSet
,
CurrencySerializer
# noqa: F401
from
.country
import
Country
,
CountrySerializer
,
CountryViewSet
# noqa: F401
from
.countryScholarship
import
CountryScholarship
,
CountryScholarshipViewSet
# noqa: F401
from
.countryDri
import
CountryDri
,
CountryDriViewSet
# noqa: F401
...
...
backend/models/
module
/currency.py
→
backend/models/
location
/currency.py
View file @
6ebf4368
...
...
@@ -5,10 +5,10 @@ from backend.models.my_model import MyModel, MyModelSerializer, MyModelViewSet
class
Currency
(
MyModel
):
code
=
models
.
CharField
(
primary_key
=
True
,
max_length
=
15
)
code
=
models
.
CharField
(
primary_key
=
True
,
max_length
=
3
)
name
=
models
.
CharField
(
max_length
=
100
)
symbol
=
models
.
CharField
(
max_length
=
5
)
one_
USD
_in_this_currency
=
models
.
DecimalField
(
symbol
=
models
.
CharField
(
null
=
True
,
blank
=
True
,
max_length
=
30
)
one_
EUR
_in_this_currency
=
models
.
DecimalField
(
max_digits
=
20
,
decimal_places
=
6
,
validators
=
[
MinValueValidator
(
0
)]
...
...
backend/models/module/__init__.py
View file @
6ebf4368
from
.basicModule
import
BasicModule
,
BasicModuleSerializer
,
BasicModuleViewSet
# noqa: F401
from
.scholarship
import
Scholarship
,
ScholarshipSerializer
,
ScholarshipViewSet
# noqa: F401
from
.driRestrictedModule
import
DriRestrictedModule
,
DriRestrictedModuleSerializer
,
DriRestrictedModuleViewSet
# noqa: F401
from
.currency
import
Currency
,
CurrencyViewSet
,
CurrencySerializer
# noqa: F401
backend/models/module/scholarship.py
View file @
6ebf4368
from
django.db
import
models
from
backend.models.module
import
BasicModule
,
BasicModuleSerializer
,
BasicModuleViewSet
from
.currency
import
Currency
from
backend.models.location
import
Currency
from
rest_framework
import
serializers
from
django.core.validators
import
MinValueValidator
...
...
backend/models/university/universityInfo.py
View file @
6ebf4368
from
django.db
import
models
from
backend.models.module
import
BasicModule
,
BasicModuleSerializer
,
BasicModuleViewSet
from
backend.models.university
import
University
from
backend.models.
module
import
Currency
from
backend.models.
location
import
Currency
from
django.core.validators
import
MinValueValidator
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment