Commit 9e62f092 authored by Florent Chehab's avatar Florent Chehab
Browse files

Merge branch 'work_on_backend' into 'master'

Work on backend

See merge request chehabfl/outgoing_rex!34
parents 9c099cdf 2303c5bd
......@@ -24,7 +24,7 @@ run_backend: generate_backend
docs:
cd docs/UML && $(MAKE) all
cd docs && $(MAKE) all
docs_clean:
cd docs/UML && $(MAKE) clean
cd docs && $(MAKE) clean
from backend.models.location import Country
from backend.models.country import Country
import os
import pandas as pd
from .loadGeneric import LoadGeneric
......
from backend.models.location import Currency
from backend.models.currency import Currency
import os
import csv
from .loadGeneric import LoadGeneric
......
from backend.models.location import City, Country
from backend.models.university import University, Campus
from backend.models.country import Country
from backend.models.city import City
from backend.models.university import University
from backend.models.campus import Campus
import os
import pandas as pd
......
# Generated by Django 2.0.3 on 2018-09-09 12:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='campus',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
migrations.AddField(
model_name='countrydri',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
migrations.AddField(
model_name='countryscholarship',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
migrations.AddField(
model_name='universitydri',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
migrations.AddField(
model_name='universityinfo',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
migrations.AddField(
model_name='universityscholarship',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
migrations.AddField(
model_name='universitysemestersdates',
name='importance_level',
field=models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2),
),
]
# 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 backend.models.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from backend.models.tools import JSONField
from backend.models.tag.tagged_item_validation import validate_content_against_config
from backend.models.tag.tags_config import USEFULL_LINKS_CONFIG
from backend.validators.tag import validate_content_against_config
from backend.validators.tag.tags_config import USEFULL_LINKS_CONFIG
IMPORTANCE_LEVEL = (
('-', 'normal'),
('+', 'important'),
('++', 'IMPORTANT')
)
class BasicModule(MyModelVersionned):
comment = models.TextField(blank=True)
usefull_links = JSONField(default=list)
importance_level = models.CharField(
max_length=2,
choices=IMPORTANCE_LEVEL,
default='-',
)
class Meta:
abstract = True
......
from .campus import Campus, CampusViewSet, CampusSerializer, MainCampusViewSet # noqa: F401
from .campusTaggedItem import CampusTaggedItem, CampusTaggedItemSerializer, CampusTaggedItemViewSet # noqa: F401
from django.db import models
from backend.models.module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.location import City
from backend.models.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.city import City
from backend.models.university import University
from django.core.validators import MinValueValidator, MaxValueValidator
from backend.utils import get_model_config, get_viewset_permissions
......
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.utils import get_model_config, get_viewset_permissions
......@@ -14,7 +14,7 @@ class CampusTaggedItem(TaggedItem):
return CampusTaggedItemSerializer
class Meta:
unique_together = ('campus', 'tag')
unique_together = ('campus', 'tag', 'importance_level')
class CampusTaggedItemSerializer(TaggedItemSerializer):
......
from .city import City, CitySerializer, CityViewSet # noqa: F401
from .cityTaggedItem import CityTaggedItem, CityTaggedItemSerializer, CityTaggedItemViewSet # noqa: F401
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.utils import get_model_config, get_viewset_permissions
......
from django.db import models
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
......@@ -15,7 +15,7 @@ class CityTaggedItem(TaggedItem):
return CityTaggedItemSerializer
class Meta:
unique_together = ('city', 'tag')
unique_together = ('city', 'tag', 'importance_level')
class CityTaggedItemSerializer(TaggedItemSerializer):
......
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
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 backend.models.location import Country
from backend.models.module import DriRestrictedModule, DriRestrictedModuleSerializer, DriRestrictedModuleViewSet
from backend.models.country import Country
from backend.models.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.utils import get_model_config, get_viewset_permissions
class CountryDri(DriRestrictedModule):
class CountryDri(BasicModule):
model_config = get_model_config("CountryDri")
country = models.ManyToManyField(
Country, related_name="country_dri")
......@@ -14,14 +14,14 @@ class CountryDri(DriRestrictedModule):
return CountryDriSerializer
class CountryDriSerializer(DriRestrictedModuleSerializer):
class CountryDriSerializer(BasicModuleSerializer):
class Meta:
model = CountryDri
fields = '__all__'
class CountryDriViewSet(DriRestrictedModuleViewSet):
class CountryDriViewSet(BasicModuleViewSet):
permission_classes = get_viewset_permissions("CountryDriViewSet")
queryset = CountryDri.objects.all() # pylint: disable=E1101
serializer_class = CountryDriSerializer
from django.db import models
from backend.models.location import Country
from backend.models.module import Scholarship, ScholarshipSerializer, ScholarshipViewSet
from backend.models.country import Country
from backend.models.scholarship import Scholarship, ScholarshipSerializer, ScholarshipViewSet
from backend.utils import get_model_config, get_viewset_permissions
......
from django.db import models
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
......@@ -14,7 +14,7 @@ class CountryTaggedItem(TaggedItem):
return CountryTaggedItemSerializer
class Meta:
unique_together = ('country', 'tag')
unique_together = ('country', 'tag', 'importance_level')
class CountryTaggedItemSerializer(TaggedItemSerializer):
......
from .currency import Currency, CurrencyViewSet, CurrencySerializer # 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