load_all.py 1.69 KB
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
import reversion
Florent Chehab's avatar
Florent Chehab committed
2

3
from backend_app.load_data.loading_scripts.loadBaseUsers import LoadBaseUsers
4 5 6
from backend_app.load_data.loading_scripts.loadCountries import LoadCountries
from backend_app.load_data.loading_scripts.loadCurrencies import LoadCurrencies
from backend_app.load_data.loading_scripts.loadGroups import LoadGroups
Segolene Brisemeur's avatar
Segolene Brisemeur committed
7
from backend_app.load_data.loading_scripts.loadLanguages import LoadLanguages
8 9 10
from backend_app.load_data.loading_scripts.loadRecommendationLists import (
    LoadRecommendationLists,
)
11 12 13 14 15
from backend_app.load_data.loading_scripts.loadSiteInformation import (
    LoadSiteInformation,
)
from backend_app.load_data.loading_scripts.loadUniversities import LoadUniversities
from backend_app.load_data.loading_scripts.loadUniversityEx import LoadUniversityEx
Florent Chehab's avatar
Florent Chehab committed
16

Florent Chehab's avatar
Florent Chehab committed
17 18

def load_all():
19 20
    """
    Function to load all the initial data in the app
Florent Chehab's avatar
Florent Chehab committed
21 22
    """

Florent Chehab's avatar
Florent Chehab committed
23
    with reversion.create_revision():
24
        LoadGroups()
25
        admin = LoadBaseUsers().get_admin()
Florent Chehab's avatar
Florent Chehab committed
26 27 28
        LoadCurrencies(admin).load()
        LoadCountries(admin).load()
        LoadUniversities(admin).load()
Segolene Brisemeur's avatar
Segolene Brisemeur committed
29
        LoadLanguages().load()
Florent Chehab's avatar
Florent Chehab committed
30
        LoadUniversityEx(admin).load()
31
        LoadRecommendationLists(admin).load()
32
        LoadSiteInformation(admin).load()
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50


def load_prod():
    """
    for PRODUCTION ENV
    Function to load all the initial data in the app
    """

    with reversion.create_revision():
        LoadGroups()
        admin = LoadBaseUsers().get_admin()
        LoadCurrencies(admin).load()
        LoadCountries(admin).load()
        LoadLanguages().load()
        LoadSiteInformation(admin).load()
        # LoadUniversities(admin).load()
        # LoadUniversityEx(admin).load()
        # LoadRecommendationLists(admin).load()