Commit d523b271 authored by Segolene's avatar Segolene

reformat backend

parent a0006f60
Pipeline #37996 passed with stages
in 4 minutes and 14 seconds
......@@ -6,9 +6,8 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('backend_app', '0002_auto_20190324_2123'),
('backend_app', '0002_auto_20190405_2131'),
("backend_app", "0002_auto_20190324_2123"),
("backend_app", "0002_auto_20190405_2131"),
]
operations = [
]
operations = []
......@@ -7,132 +7,102 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend_app', '0003_merge_20190406_1636'),
]
dependencies = [("backend_app", "0003_merge_20190406_1636")]
operations = [
migrations.RenameField(
model_name='coursefeedback',
old_name='work_dose',
new_name='working_dose',
),
migrations.RemoveField(
model_name='course',
name='description',
),
migrations.RemoveField(
model_name='course',
name='has_pending_moderation',
),
migrations.RemoveField(
model_name='course',
name='moderated_by',
),
migrations.RemoveField(
model_name='course',
name='moderated_on',
),
migrations.RemoveField(
model_name='course',
name='obj_moderation_level',
),
migrations.RemoveField(
model_name='course',
name='updated_by',
),
migrations.RemoveField(
model_name='course',
name='updated_on',
),
migrations.RemoveField(
model_name='coursefeedback',
name='departure',
),
migrations.RemoveField(
model_name='exchange',
name='has_pending_moderation',
),
migrations.RemoveField(
model_name='exchange',
name='is_anonymous',
),
migrations.RemoveField(
model_name='exchange',
name='moderated_by',
),
migrations.RemoveField(
model_name='exchange',
name='moderated_on',
),
migrations.RemoveField(
model_name='exchange',
name='obj_moderation_level',
),
migrations.RemoveField(
model_name='exchange',
name='updated_by',
),
migrations.RemoveField(
model_name='exchange',
name='updated_on',
),
migrations.RemoveField(
model_name='exchangefeedback',
name='departure',
),
migrations.RemoveField(
model_name='exchangefeedback',
name='id',
),
model_name="coursefeedback", old_name="work_dose", new_name="working_dose"
),
migrations.RemoveField(model_name="course", name="description"),
migrations.RemoveField(model_name="course", name="has_pending_moderation"),
migrations.RemoveField(model_name="course", name="moderated_by"),
migrations.RemoveField(model_name="course", name="moderated_on"),
migrations.RemoveField(model_name="course", name="obj_moderation_level"),
migrations.RemoveField(model_name="course", name="updated_by"),
migrations.RemoveField(model_name="course", name="updated_on"),
migrations.RemoveField(model_name="coursefeedback", name="departure"),
migrations.RemoveField(model_name="exchange", name="has_pending_moderation"),
migrations.RemoveField(model_name="exchange", name="is_anonymous"),
migrations.RemoveField(model_name="exchange", name="moderated_by"),
migrations.RemoveField(model_name="exchange", name="moderated_on"),
migrations.RemoveField(model_name="exchange", name="obj_moderation_level"),
migrations.RemoveField(model_name="exchange", name="updated_by"),
migrations.RemoveField(model_name="exchange", name="updated_on"),
migrations.RemoveField(model_name="exchangefeedback", name="departure"),
migrations.RemoveField(model_name="exchangefeedback", name="id"),
migrations.AddField(
model_name='course',
name='category',
model_name="course",
name="category",
field=models.CharField(blank=True, max_length=5, null=True),
),
migrations.AddField(
model_name='coursefeedback',
name='course',
field=models.ForeignKey(default=0, on_delete=django.db.models.deletion.CASCADE, to='backend_app.Course'),
model_name="coursefeedback",
name="course",
field=models.ForeignKey(
default=0,
on_delete=django.db.models.deletion.CASCADE,
to="backend_app.Course",
),
),
migrations.AddField(
model_name='coursefeedback',
name='university',
field=models.ForeignKey(default=0, on_delete=django.db.models.deletion.PROTECT, to='backend_app.University'),
model_name="coursefeedback",
name="university",
field=models.ForeignKey(
default=0,
on_delete=django.db.models.deletion.PROTECT,
to="backend_app.University",
),
),
migrations.AddField(
model_name='exchangefeedback',
name='exchange',
field=models.OneToOneField(default=0, on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='feedbacks', serialize=False, to='backend_app.Exchange'),
model_name="exchangefeedback",
name="exchange",
field=models.OneToOneField(
default=0,
on_delete=django.db.models.deletion.CASCADE,
primary_key=True,
related_name="feedbacks",
serialize=False,
to="backend_app.Exchange",
),
),
migrations.AddField(
model_name='exchangefeedback',
name='university',
field=models.ForeignKey(default=0, on_delete=django.db.models.deletion.PROTECT, to='backend_app.University'),
model_name="exchangefeedback",
name="university",
field=models.ForeignKey(
default=0,
on_delete=django.db.models.deletion.PROTECT,
to="backend_app.University",
),
),
migrations.AlterField(
model_name='exchange',
name='semester',
field=models.CharField(choices=[('a', 'autumn'), ('p', 'spring')], default='a', max_length=5),
model_name="exchange",
name="semester",
field=models.CharField(
choices=[("a", "autumn"), ("p", "spring")], default="a", max_length=5
),
),
migrations.AlterField(
model_name='exchange',
name='student_major',
model_name="exchange",
name="student_major",
field=models.CharField(max_length=20),
),
migrations.AlterField(
model_name='exchange',
name='student_minor',
model_name="exchange",
name="student_minor",
field=models.CharField(max_length=7),
),
migrations.AlterField(
model_name='exchange',
name='student_option',
model_name="exchange",
name="student_option",
field=models.CharField(max_length=7),
),
migrations.AlterField(
model_name='exchange',
name='user',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
model_name="exchange",
name="user",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to=settings.AUTH_USER_MODEL,
),
),
]
from django.db import models
from base_app.models import User
from backend_app.models.abstract.base import (
BaseModel,
BaseModelSerializer,
)
from backend_app.models.abstract.base import BaseModel, BaseModelSerializer
from backend_app.models.exchange import Exchange
......@@ -27,4 +22,3 @@ class CourseSerializer(BaseModelSerializer):
class Meta:
model = Course
fields = "__all__"
......@@ -14,9 +14,15 @@ class CourseFeedback(EssentialModule):
university = models.ForeignKey(University, on_delete=models.PROTECT, default=0)
course = models.ForeignKey(Course, on_delete=models.CASCADE, default=0)
comment = models.TextField(null=True, max_length=1500)
adequation = models.IntegerField(validators=[MaxValueValidator(5), MinValueValidator(-5)])
working_dose = models.IntegerField(validators=[MaxValueValidator(5), MinValueValidator(-5)])
language_following_ease = models.IntegerField(validators=[MaxValueValidator(5), MinValueValidator(-5)])
adequation = models.IntegerField(
validators=[MaxValueValidator(5), MinValueValidator(-5)]
)
working_dose = models.IntegerField(
validators=[MaxValueValidator(5), MinValueValidator(-5)]
)
language_following_ease = models.IntegerField(
validators=[MaxValueValidator(5), MinValueValidator(-5)]
)
is_psf_credit = models.BooleanField()
......@@ -32,4 +38,3 @@ class CourseFeedbackViewSet(EssentialModuleViewSet):
queryset = CourseFeedback.objects.all().prefetch_related() # pylint: disable=E1101
serializer_class = CourseFeedbackSerializer
end_point_route = "courseFeedbacks"
......@@ -3,10 +3,7 @@ from backend_app.models.university import University
from base_app.models import User
from backend_app.fields import JSONField
from backend_app.models.abstract.base import (
BaseModel,
BaseModelSerializer,
)
from backend_app.models.abstract.base import BaseModel, BaseModelSerializer
from backend_app.models.shared import SEMESTER_OPTIONS
......@@ -35,6 +32,13 @@ class Exchange(BaseModel):
class ExchangeSerializer(BaseModelSerializer):
class Meta:
model = Exchange
fields = BaseModelSerializer.Meta.fields + ("year", "semester", "duration", "dual_degree", "master_obtained",
"student_major", "studentminor", "student_option")
fields = BaseModelSerializer.Meta.fields + (
"year",
"semester",
"duration",
"dual_degree",
"master_obtained",
"student_major",
"studentminor",
"student_option",
)
......@@ -18,12 +18,16 @@ class ExchangeFeedback(EssentialModule):
related_name="feedbacks",
primary_key=True,
null=False,
default=0
default=0,
)
general_comment = models.TextField(null=True, max_length=1500)
academical_level_appreciation = models.IntegerField(validators=[MaxValueValidator(5), MinValueValidator(-5)])
foreign_student_welcome = models.PositiveIntegerField(validators=[MaxValueValidator(10), ])
cultural_interest = models.PositiveIntegerField(validators=[MaxValueValidator(10), ])
academical_level_appreciation = models.IntegerField(
validators=[MaxValueValidator(5), MinValueValidator(-5)]
)
foreign_student_welcome = models.PositiveIntegerField(
validators=[MaxValueValidator(10)]
)
cultural_interest = models.PositiveIntegerField(validators=[MaxValueValidator(10)])
class ExchangeFeedbackSerializer(EssentialModuleSerializer):
......@@ -36,4 +40,3 @@ class ExchangeFeedbackViewSet(EssentialModuleViewSet):
queryset = ExchangeFeedback.objects.all() # pylint: disable=E1101
serializer_class = ExchangeFeedbackSerializer
end_point_route = "exchangeFeedbacks"
......@@ -21,9 +21,7 @@ from backend_app.models.pendingModeration import (
PendingModerationViewSet,
PendingModerationObjViewSet,
)
from backend_app.models.exchangeFeedback import (
ExchangeFeedbackViewSet,
)
from backend_app.models.exchangeFeedback import ExchangeFeedbackViewSet
from backend_app.models.recommendation import RecommendationViewSet
from backend_app.models.recommendationList import RecommendationListViewSet
from backend_app.models.specialty import SpecialtyViewSet
......
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