Commit 04c716cf authored by Florent Chehab's avatar Florent Chehab
Browse files

Merge branch 'update_back_linting' into 'master'

Update back linting and fix documentation job failing on master

Closes #44

See merge request !44
parents 3a3bbbd2 955238be
Pipeline #34792 passed with stages
in 2 minutes and 57 seconds
......@@ -14,19 +14,18 @@ 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')
EPFL = University.objects.get(acronym="EPFL")
CHF = Currency.objects.get(pk="CHF")
ACCOMMODATION_TAG = Tag.objects.get(name="accommodation")
SWITZERLAND = Country.objects.get(pk="CH")
univ_dri_1 = UniversityDri(
title="Cours en anglais",
importance_level='+',
importance_level="+",
comment="Les cours de master en computer science sont 100% en anglais",
)
univ_dri_1.save()
......@@ -38,13 +37,14 @@ class LoadUniversityEx(LoadGeneric):
univ_info.costs_currency = CHF
self.add_info_and_save(univ_info, self.admin)
usd = UniversitySemestersDates.objects.get(
university=EPFL)
usd.autumn_begin = datetime.strptime("17/09/2018", '%d/%m/%Y')
usd.autumn_end = datetime.strptime("29/01/2019", '%d/%m/%Y')
usd = UniversitySemestersDates.objects.get(university=EPFL)
usd.autumn_begin = datetime.strptime("17/09/2018", "%d/%m/%Y")
usd.autumn_end = datetime.strptime("29/01/2019", "%d/%m/%Y")
usd.useful_links = [
{"url": "https://memento.epfl.ch/academic-calendar",
"description": "Site de l'EPFL"}
{
"url": "https://memento.epfl.ch/academic-calendar",
"description": "Site de l'EPFL",
}
]
self.add_info_and_save(usd, self.admin)
......@@ -52,10 +52,10 @@ class LoadUniversityEx(LoadGeneric):
title="Swiss European Mobility Programme",
type="Bourse du gouvernement suisse",
currency=CHF,
frequency='s',
frequency="s",
amount_min=2200,
amount_max=2200,
comment="Bourse attribuée de manière automatique."
comment="Bourse attribuée de manière automatique.",
)
country_scholarship.save()
country_scholarship.countries.add(SWITZERLAND)
......@@ -66,6 +66,6 @@ class LoadUniversityEx(LoadGeneric):
tag=ACCOMMODATION_TAG,
title="C'est compliqué de trouver un logement",
comment="Mon commentaire.",
importance_level='++'
importance_level="++",
)
self.add_info_and_save(univ_tag_1, self.admin)
......@@ -6,204 +6,208 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend_app', '0001_initial'),
]
dependencies = [("backend_app", "0001_initial")]
operations = [
migrations.AlterField(
model_name='campus',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="campus",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='campus',
name='name',
field=models.CharField(blank=True, default='', max_length=200),
model_name="campus",
name="name",
field=models.CharField(blank=True, default="", max_length=200),
),
migrations.AlterField(
model_name='campus',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="campus",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
migrations.AlterField(
model_name='campustaggeditem',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="campustaggeditem",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='campustaggeditem',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="campustaggeditem",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
migrations.AlterField(
model_name='city',
name='area',
field=models.CharField(blank=True, default='', max_length=200),
model_name="city",
name="area",
field=models.CharField(blank=True, default="", max_length=200),
),
migrations.AlterField(
model_name='city',
name='local_name',
field=models.CharField(blank=True, default='', max_length=200),
model_name="city",
name="local_name",
field=models.CharField(blank=True, default="", max_length=200),
),
migrations.AlterField(
model_name='citytaggeditem',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="citytaggeditem",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='citytaggeditem',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="citytaggeditem",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
migrations.AlterField(
model_name='country',
name='intermediate_region_name',
field=models.CharField(blank=True, default='', max_length=200),
model_name="country",
name="intermediate_region_name",
field=models.CharField(blank=True, default="", max_length=200),
),
migrations.AlterField(
model_name='country',
name='intermediate_region_un_code',
field=models.CharField(blank=True, default='', max_length=3),
model_name="country",
name="intermediate_region_un_code",
field=models.CharField(blank=True, default="", max_length=3),
),
migrations.AlterField(
model_name='country',
name='iso_alpha3_code',
field=models.CharField(blank=True, default='', max_length=3, unique=True),
model_name="country",
name="iso_alpha3_code",
field=models.CharField(blank=True, default="", max_length=3, unique=True),
),
migrations.AlterField(
model_name='country',
name='sub_region_name',
field=models.CharField(blank=True, default='', max_length=200),
model_name="country",
name="sub_region_name",
field=models.CharField(blank=True, default="", max_length=200),
),
migrations.AlterField(
model_name='country',
name='sub_region_un_code',
field=models.CharField(blank=True, default='', max_length=3),
model_name="country",
name="sub_region_un_code",
field=models.CharField(blank=True, default="", max_length=3),
),
migrations.AlterField(
model_name='countrydri',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="countrydri",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='countrydri',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="countrydri",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
migrations.AlterField(
model_name='countryscholarship',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="countryscholarship",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='countryscholarship',
name='other_advantages',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="countryscholarship",
name="other_advantages",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='countryscholarship',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="countryscholarship",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
migrations.AlterField(
model_name='countrytaggeditem',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="countrytaggeditem",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='countrytaggeditem',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="countrytaggeditem",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
migrations.AlterField(
model_name='currency',
name='symbol',
field=models.CharField(blank=True, default='', max_length=30),
model_name="currency",
name="symbol",
field=models.CharField(blank=True, default="", max_length=30),
),
migrations.AlterField(
model_name='previousdeparturefeedback',
name='adequation_comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="previousdeparturefeedback",
name="adequation_comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='previousdeparturefeedback',
name='integration_comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="previousdeparturefeedback",
name="integration_comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='recommendation',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="recommendation",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='university',
name='acronym',
field=models.CharField(blank=True, default='', max_length=20),
model_name="university",
name="acronym",
field=models.CharField(blank=True, default="", max_length=20),
),
migrations.AlterField(
model_name='university',
name='logo',
field=models.URLField(blank=True, default='', validators=[backend_app.models.university.university.validate_extension_django]),
model_name="university",
name="logo",
field=models.URLField(
blank=True,
default="",
validators=[
backend_app.models.university.university.validate_extension_django
],
),
),
migrations.AlterField(
model_name='university',
name='website',
field=models.URLField(blank=True, default='', max_length=300),
model_name="university",
name="website",
field=models.URLField(blank=True, default="", max_length=300),
),
migrations.AlterField(
model_name='universitydri',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="universitydri",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='universitydri',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="universitydri",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
migrations.AlterField(
model_name='universityinfo',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="universityinfo",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='universityinfo',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="universityinfo",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
migrations.AlterField(
model_name='universityscholarship',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="universityscholarship",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='universityscholarship',
name='other_advantages',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="universityscholarship",
name="other_advantages",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='universityscholarship',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="universityscholarship",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
migrations.AlterField(
model_name='universitysemestersdates',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="universitysemestersdates",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='universitysemestersdates',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="universitysemestersdates",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
migrations.AlterField(
model_name='universitytaggeditem',
name='comment',
field=models.CharField(blank=True, default='', max_length=5000),
model_name="universitytaggeditem",
name="comment",
field=models.CharField(blank=True, default="", max_length=5000),
),
migrations.AlterField(
model_name='universitytaggeditem',
name='title',
field=models.CharField(blank=True, default='', max_length=150),
model_name="universitytaggeditem",
name="title",
field=models.CharField(blank=True, default="", max_length=150),
),
]
......@@ -5,19 +5,41 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend_app', '0002_auto_20180916_1555'),
]
dependencies = [("backend_app", "0002_auto_20180916_1555")]
operations = [
migrations.AlterField(
model_name='countryscholarship',
name='frequency',
field=models.CharField(blank=True, choices=[('w', 'week'), ('m', 'month'), ('s', 'semester'), ('y', 'year'), ('o', 'one_shot')], default='m', max_length=1, null=True),
model_name="countryscholarship",
name="frequency",
field=models.CharField(
blank=True,
choices=[
("w", "week"),
("m", "month"),
("s", "semester"),
("y", "year"),
("o", "one_shot"),
],
default="m",
max_length=1,
null=True,
),
),
migrations.AlterField(
model_name='universityscholarship',
name='frequency',
field=models.CharField(blank=True, choices=[('w', 'week'), ('m', 'month'), ('s', 'semester'), ('y', 'year'), ('o', 'one_shot')], default='m', max_length=1, null=True),
model_name="universityscholarship",
name="frequency",
field=models.CharField(
blank=True,
choices=[
("w", "week"),
("m", "month"),
("s", "semester"),
("y", "year"),
("o", "one_shot"),
],
default="m",
max_length=1,
null=True,
),
),
]
from .basicModule import BasicModule, BasicModuleSerializer, BasicModuleViewSet # noqa: F401
from .basicModule import BasicModule, BasicModuleSerializer, BasicModuleViewSet
__all__ = ["BasicModule", "BasicModuleSerializer", "BasicModuleViewSet"]
from django.db import models
from backend_app.models.abstract.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from backend_app.models.abstract.my_model import (
MyModelVersionned,
MyModelVersionnedSerializer,
MyModelVersionnedViewSet,
)
from backend_app.fields import JSONField
from backend_app.validators.tag import validate_content_against_config
from backend_app.validators.tag.tags_config import USEFULL_LINKS_CONFIG
IMPORTANCE_LEVEL = (
('-', 'normal'),
('+', 'important'),
('++', 'IMPORTANT')
)
IMPORTANCE_LEVEL = (("-", "normal"), ("+", "important"), ("++", "IMPORTANT"))
class BasicModule(MyModelVersionned):
title = models.CharField(default='', blank=True, max_length=150)
comment = models.CharField(default='', blank=True, max_length=5000)
title = models.CharField(default="", blank=True, max_length=150)
comment = models.CharField(default="", blank=True, max_length=5000)
useful_links = JSONField(default=list)
importance_level = models.CharField(
max_length=2,
choices=IMPORTANCE_LEVEL,
default='-',
max_length=2, choices=IMPORTANCE_LEVEL, default="-"
)
class Meta:
......@@ -26,16 +24,15 @@ class BasicModule(MyModelVersionned):
class BasicModuleSerializer(MyModelVersionnedSerializer):
def my_validate(self, attrs):
content = {'useful_links': attrs['useful_links']}
config = {'useful_links': USEFULL_LINKS_CONFIG}
content = {"useful_links": attrs["useful_links"]}
config = {"useful_links": USEFULL_LINKS_CONFIG}
validate_content_against_config(config, content)
return attrs
class Meta:
model = BasicModule
fields = '__all__'
fields = "__all__"
class BasicModuleViewSet(MyModelVersionnedViewSet):
......
from .myModel import MyModel # noqa: F401
from .myModelSerializer import MyModelSerializer # noqa: F401
from .myModelViewSet import MyModelViewSet # noqa: F401
from .pendingModeration import PendingModeration, PendingModerationSerializer, PendingModerationViewSet # noqa: F401
from .forTestingModeration import ForTestingModeration, ForTestingModerationSerializer, ForTestingModerationViewSet # noqa: F401
from .myModelVersionned import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet, VersionViewSet # noqa: F401
from .forTestingVersioning import ForTestingVersioning, ForTestingVersioningSerializer, ForTestingVersioningViewSet # noqa: F401
from .myModel import MyModel
from .myModelSerializer import MyModelSerializer
from .myModelViewSet import MyModelViewSet
from .pendingModeration import (
PendingModeration,
PendingModerationSerializer,
PendingModerationViewSet,
)
from .forTestingModeration import (
ForTestingModeration,
ForTestingModerationSerializer,
ForTestingModerationViewSet,
)
from .myModelVersionned import (
MyModelVersionned,
MyModelVersionnedSerializer,
MyModelVersionnedViewSet,
VersionViewSet,
)
from .forTestingVersioning import (
ForTestingVersioning,
ForTestingVersioningSerializer,
ForTestingVersioningViewSet,
)
__all__ = [
"MyModel",
"MyModelSerializer",
"MyModelViewSet",
"PendingModeration",
"PendingModerationSerializer",
"PendingModerationViewSet",
"ForTestingModeration",
"ForTestingModerationSerializer",
"ForTestingModerationViewSet",
"MyModelVersionned",
"MyModelVersionnedSerializer",
"MyModelVersionnedViewSet",
"VersionViewSet",
"ForTestingVersioning",