Commit c7a149a0 authored by Florent Chehab's avatar Florent Chehab
Browse files

updated loading scripts

parent 9743527c
......@@ -17,7 +17,7 @@
"config": {}
},
{
"name": "accomodation",
"name": "accommodation",
"config": {}
},
{
......
......@@ -3,6 +3,7 @@ from .loading_scripts import LoadCurrencies
from .loading_scripts import LoadCountries
from .loading_scripts import LoadUniversities
from .loading_scripts import LoadTags
from .loading_scripts import LoadUniversityEx
def load_all():
......@@ -11,3 +12,4 @@ def load_all():
LoadCountries(admin).load()
LoadUniversities(admin).load()
LoadTags(admin).load()
LoadUniversityEx(admin).load()
......@@ -3,3 +3,4 @@ from .loadCountries import LoadCountries # noqa: F401
from .loadUniversities import LoadUniversities # noqa: F401
from .loadTags import LoadTags # noqa: F401
from .loadCurrencies import LoadCurrencies # noqa: F401
from .loadUniversityEx import LoadUniversityEx # noqa: F401
from .loadGeneric import LoadGeneric
from backend.models.university import University
from backend.models.university import UniversityDri
from backend.models.university import UniversityInfo
from backend.models.university import UniversitySemestersDates
from backend.models.university import UniversityScholarship
from backend.models.university import UniversityTaggedItem
from backend.models.currency import Currency
from backend.models.tag import Tag
from datetime import datetime
class LoadUniversityEx(LoadGeneric):
def __init__(self, admin):
self.admin = admin
def load(self):
EPFL = University.objects.get(acronym='EPFL')
CHF = Currency.objects.get(pk='CHF')
ACCOMMODATION_TAG = Tag.objects.get(name='accommodation')
univ_dri_1 = UniversityDri(
comment="Attention les cours de master sont 100% en anglais")
univ_dri_1.save()
univ_dri_1.university.add(EPFL)
univ_dri_1.save()
self.add_info(univ_dri_1, self.admin)
univ_info = UniversityInfo(
university=EPFL,
cost_exchange=0,
costs_currency=CHF
)
univ_info.save()
self.add_info(univ_info, self.admin)
univ_semesters_dates = UniversitySemestersDates(
university=EPFL,
autumn_begin=datetime.strptime("17/09/2018", '%d/%m/%Y'),
autumn_end=datetime.strptime("29/01/2019", '%d/%m/%Y')
)
univ_semesters_dates.save()
self.add_info(univ_semesters_dates, self.admin)
univ_scholarship_1 = UniversityScholarship(
type="Swiss European...",
currency=CHF,
frequency='s',
amount_min=2200,
amount_max=2200,
comment="Il n'y a rien à faire pour l'obtenir"
)
univ_scholarship_1.save()
univ_scholarship_1.university.add(EPFL)
univ_scholarship_1.save()
self.add_info(univ_scholarship_1, self.admin)
univ_tag_1 = UniversityTaggedItem(
university=EPFL,
tag=ACCOMMODATION_TAG,
title="C'est compliqué de trouver un logement",
comment="Mon commentaire.",
importance_level='++'
)
univ_tag_1.save()
self.add_info(univ_tag_1, self.admin)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment