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

Backend completely reorganized to limit cyclic imports

parent c776e24f
Pipeline #27073 passed with stages
in 2 minutes and 27 seconds
from backend.models.location import Country from backend.models.country import Country
import os import os
import pandas as pd import pandas as pd
from .loadGeneric import LoadGeneric from .loadGeneric import LoadGeneric
......
from backend.models.location import Currency from backend.models.currency import Currency
import os import os
import csv import csv
from .loadGeneric import LoadGeneric from .loadGeneric import LoadGeneric
......
from backend.models.location import City, Country from backend.models.country import Country
from backend.models.university import University, Campus from backend.models.city import City
from backend.models.university import University
from backend.models.campus import Campus
import os import os
import pandas as pd import pandas as pd
......
# Generated by Django 2.0.3 on 2018-09-09 13:47
import backend.models.tools.jSONField
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0002_auto_20180909_1455'),
]
operations = [
migrations.AddField(
model_name='campustaggeditem',
name='comment',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='campustaggeditem',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
migrations.AddField(
model_name='campustaggeditem',
name='usefull_links',
field=backend.models.tools.jSONField.JSONField(default=list),
),
migrations.AddField(
model_name='citytaggeditem',
name='comment',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='citytaggeditem',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
migrations.AddField(
model_name='citytaggeditem',
name='usefull_links',
field=backend.models.tools.jSONField.JSONField(default=list),
),
migrations.AddField(
model_name='countrytaggeditem',
name='comment',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='countrytaggeditem',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
migrations.AddField(
model_name='countrytaggeditem',
name='usefull_links',
field=backend.models.tools.jSONField.JSONField(default=list),
),
migrations.AddField(
model_name='universitytaggeditem',
name='comment',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='universitytaggeditem',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
migrations.AddField(
model_name='universitytaggeditem',
name='usefull_links',
field=backend.models.tools.jSONField.JSONField(default=list),
),
]
from .basicModule import BasicModule, BasicModuleSerializer, BasicModuleViewSet # noqa: F401
from django.db import models from django.db import models
from backend.models.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet from backend.models.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from backend.models.tools import JSONField from backend.models.tools import JSONField
from backend.models.tag.tagged_item_validation import validate_content_against_config from backend.validators.tag import validate_content_against_config
from backend.models.tag.tags_config import USEFULL_LINKS_CONFIG from backend.validators.tag.tags_config import USEFULL_LINKS_CONFIG
IMPORTANCE_LEVEL = ( IMPORTANCE_LEVEL = (
('-', 'normal'), ('-', 'normal'),
......
from .campus import Campus, CampusViewSet, CampusSerializer, MainCampusViewSet # noqa: F401
from .campusTaggedItem import CampusTaggedItem, CampusTaggedItemSerializer, CampusTaggedItemViewSet # noqa: F401
from django.db import models from django.db import models
from backend.models.module import BasicModule, BasicModuleSerializer, BasicModuleViewSet from backend.models.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.location import City from backend.models.city import City
from backend.models.university import University from backend.models.university import University
from django.core.validators import MinValueValidator, MaxValueValidator from django.core.validators import MinValueValidator, MaxValueValidator
from backend.utils import get_model_config, get_viewset_permissions from backend.utils import get_model_config, get_viewset_permissions
......
from django.db import models from django.db import models
from backend.models.university import Campus from backend.models.campus import Campus
from backend.models.tag import TaggedItem, TaggedItemSerializer, TaggedItemViewSet from backend.models.tag import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.utils import get_model_config, get_viewset_permissions from backend.utils import get_model_config, get_viewset_permissions
......
from .city import City, CitySerializer, CityViewSet # noqa: F401
from .cityTaggedItem import CityTaggedItem, CityTaggedItemSerializer, CityTaggedItemViewSet # noqa: F401
from django.db import models from django.db import models
from backend.models.location import Country from backend.models.country import Country
from backend.models.my_model import MyModel, MyModelSerializer, MyModelVersionnedViewSet from backend.models.my_model import MyModel, MyModelSerializer, MyModelVersionnedViewSet
from backend.utils import get_model_config, get_viewset_permissions from backend.utils import get_model_config, get_viewset_permissions
......
from django.db import models from django.db import models
from backend.models.tag import TaggedItem, TaggedItemSerializer, TaggedItemViewSet from backend.models.tag import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.models.location import City from backend.models.city import City
from backend.utils import get_model_config, get_viewset_permissions from backend.utils import get_model_config, get_viewset_permissions
......
from .currency import Currency, CurrencyViewSet, CurrencySerializer # noqa: F401
from .country import Country, CountrySerializer, CountryViewSet # noqa: F401 from .country import Country, CountrySerializer, CountryViewSet # noqa: F401
from .countryScholarship import CountryScholarship, CountryScholarshipViewSet # noqa: F401 from .countryScholarship import CountryScholarship, CountryScholarshipViewSet # noqa: F401
from .countryDri import CountryDri, CountryDriViewSet # noqa: F401 from .countryDri import CountryDri, CountryDriViewSet # noqa: F401
from .countryTaggedItem import CountryTaggedItem, CountryTaggedItemSerializer, CountryTaggedItemViewSet # noqa: F401 from .countryTaggedItem import CountryTaggedItem, CountryTaggedItemSerializer, CountryTaggedItemViewSet # noqa: F401
from .city import City, CitySerializer, CityViewSet # noqa: F401
from .cityTaggedItem import CityTaggedItem, CityTaggedItemSerializer, CityTaggedItemViewSet # noqa: F401
from django.db import models from django.db import models
from backend.models.location import Country from backend.models.country import Country
from backend.models.module import DriRestrictedModule, DriRestrictedModuleSerializer, DriRestrictedModuleViewSet from backend.models.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.utils import get_model_config, get_viewset_permissions from backend.utils import get_model_config, get_viewset_permissions
class CountryDri(DriRestrictedModule): class CountryDri(BasicModule):
model_config = get_model_config("CountryDri") model_config = get_model_config("CountryDri")
country = models.ManyToManyField( country = models.ManyToManyField(
Country, related_name="country_dri") Country, related_name="country_dri")
...@@ -14,14 +14,14 @@ class CountryDri(DriRestrictedModule): ...@@ -14,14 +14,14 @@ class CountryDri(DriRestrictedModule):
return CountryDriSerializer return CountryDriSerializer
class CountryDriSerializer(DriRestrictedModuleSerializer): class CountryDriSerializer(BasicModuleSerializer):
class Meta: class Meta:
model = CountryDri model = CountryDri
fields = '__all__' fields = '__all__'
class CountryDriViewSet(DriRestrictedModuleViewSet): class CountryDriViewSet(BasicModuleViewSet):
permission_classes = get_viewset_permissions("CountryDriViewSet") permission_classes = get_viewset_permissions("CountryDriViewSet")
queryset = CountryDri.objects.all() # pylint: disable=E1101 queryset = CountryDri.objects.all() # pylint: disable=E1101
serializer_class = CountryDriSerializer serializer_class = CountryDriSerializer
from django.db import models from django.db import models
from backend.models.location import Country from backend.models.country import Country
from backend.models.module import Scholarship, ScholarshipSerializer, ScholarshipViewSet from backend.models.scholarship import Scholarship, ScholarshipSerializer, ScholarshipViewSet
from backend.utils import get_model_config, get_viewset_permissions from backend.utils import get_model_config, get_viewset_permissions
......
from django.db import models from django.db import models
from backend.models.tag import TaggedItem, TaggedItemSerializer, TaggedItemViewSet from backend.models.tag import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.models.location import Country from backend.models.country import Country
from backend.utils import get_model_config, get_viewset_permissions from backend.utils import get_model_config, get_viewset_permissions
......
from .currency import Currency, CurrencyViewSet, CurrencySerializer # noqa: F401
from .basicModule import BasicModule, BasicModuleSerializer, BasicModuleViewSet # noqa: F401
from .scholarship import Scholarship, ScholarshipSerializer, ScholarshipViewSet # noqa: F401
from .driRestrictedModule import DriRestrictedModule, DriRestrictedModuleSerializer, DriRestrictedModuleViewSet # noqa: F401
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