Commit 6d7d3f44 authored by Florent Chehab's avatar Florent Chehab

Migrated from standard Django model to a custom one for optmization concerns

parent e8f37050
from django.contrib.auth.models import User
from base_app.models import User
import os
......
import os
from django.contrib.auth.models import User
from base_app.models import User
import pandas as pd
from backend_app.models.country import Country
......
......@@ -2,7 +2,7 @@ import csv
import os
from decimal import Decimal
from django.contrib.auth.models import User
from base_app.models import User
from backend_app.models.currency import Currency
......
from django.contrib.auth.models import User
from base_app.models import User
from django.utils import timezone
import reversion
......
import json
import os
from django.contrib.auth.models import User
from base_app.models import User
from backend_app.models.tag import Tag
......
import os
from django.contrib.auth.models import User
from base_app.models import User
import pandas as pd
from backend_app.models.campus import Campus
......
from datetime import datetime
from django.contrib.auth.models import User
from base_app.models import User
from backend_app.models.country import Country, CountryScholarship
from backend_app.models.currency import Currency
......
# Generated by Django 2.0.3 on 2018-09-16 13:31
# Generated by Django 2.1.7 on 2019-03-10 13:41
import backend_app.fields
import backend_app.models.abstract.my_model.myModel
......@@ -14,9 +14,9 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
("auth", "0009_alter_user_last_name_max_length"),
("contenttypes", "0002_remove_content_type_name"),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("contenttypes", "0002_remove_content_type_name"),
("base_app", "0001_initial"),
]
operations = [
......@@ -32,8 +32,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -44,8 +44,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -60,7 +60,7 @@ class Migration(migrations.Migration):
),
),
("is_main_campus", models.BooleanField()),
("name", models.CharField(default="", max_length=200)),
("name", models.CharField(blank=True, default="", max_length=200)),
(
"lat",
models.DecimalField(
......@@ -97,8 +97,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -109,8 +109,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -147,8 +147,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -160,8 +160,11 @@ class Migration(migrations.Migration):
),
),
("name", models.CharField(max_length=200)),
("local_name", models.CharField(default="", max_length=200)),
("area", models.CharField(default="", max_length=200)),
(
"local_name",
models.CharField(blank=True, default="", max_length=200),
),
("area", models.CharField(blank=True, default="", max_length=200)),
],
options={"abstract": False},
),
......@@ -177,8 +180,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -189,8 +192,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -218,8 +221,8 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="Country",
fields=[
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -237,19 +240,25 @@ class Migration(migrations.Migration):
),
(
"iso_alpha3_code",
models.CharField(default="", max_length=3, unique=True),
models.CharField(blank=True, default="", max_length=3, unique=True),
),
("region_name", models.CharField(max_length=200)),
("region_un_code", models.CharField(max_length=3)),
("sub_region_name", models.CharField(default="", max_length=200)),
("sub_region_un_code", models.CharField(default="", max_length=3)),
(
"sub_region_name",
models.CharField(blank=True, default="", max_length=200),
),
(
"sub_region_un_code",
models.CharField(blank=True, default="", max_length=3),
),
(
"intermediate_region_name",
models.CharField(default="", max_length=200),
models.CharField(blank=True, default="", max_length=200),
),
(
"intermediate_region_un_code",
models.CharField(default="", max_length=3),
models.CharField(blank=True, default="", max_length=3),
),
],
options={"abstract": False},
......@@ -266,8 +275,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -278,8 +287,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -314,8 +323,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -326,8 +335,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -342,10 +351,14 @@ class Migration(migrations.Migration):
),
),
("type", models.CharField(max_length=200)),
("other_advantages", models.CharField(default="", max_length=5000)),
(
"other_advantages",
models.CharField(blank=True, default="", max_length=5000),
),
(
"frequency",
models.CharField(
blank=True,
choices=[
("w", "week"),
("m", "month"),
......@@ -355,6 +368,7 @@ class Migration(migrations.Migration):
],
default="m",
max_length=1,
null=True,
),
),
(
......@@ -396,8 +410,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -408,8 +422,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -437,8 +451,8 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="Currency",
fields=[
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -454,7 +468,7 @@ class Migration(migrations.Migration):
models.CharField(max_length=3, primary_key=True, serialize=False),
),
("name", models.CharField(max_length=100)),
("symbol", models.CharField(default="", max_length=30)),
("symbol", models.CharField(blank=True, default="", max_length=30)),
(
"one_EUR_in_this_currency",
models.DecimalField(
......@@ -469,8 +483,8 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="Department",
fields=[
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -502,8 +516,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -530,8 +544,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -558,8 +572,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -570,6 +584,15 @@ class Migration(migrations.Migration):
],
),
),
("year", models.PositiveIntegerField(default=2018)),
(
"semester",
models.CharField(
choices=[("a", "autumn"), ("p", "spring")],
default="a",
max_length=2,
),
),
("nb_seats_offered", models.PositiveIntegerField()),
("nb_seats_offered_exchange", models.PositiveIntegerField(null=True)),
(
......@@ -577,6 +600,7 @@ class Migration(migrations.Migration):
models.PositiveIntegerField(null=True),
),
],
options={"abstract": False},
),
migrations.CreateModel(
name="PendingModeration",
......@@ -614,8 +638,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -627,6 +651,15 @@ class Migration(migrations.Migration):
),
),
("Utc_departure_id", models.IntegerField()),
("year", models.PositiveIntegerField(default=2018)),
(
"semester",
models.CharField(
choices=[("a", "autumn"), ("p", "spring")],
default="a",
max_length=2,
),
),
("is_anonymous", models.BooleanField()),
("courses", backend_app.fields.JSONField(null=True)),
],
......@@ -644,8 +677,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -662,8 +695,14 @@ class Migration(migrations.Migration):
"courses_and_courses_feedback",
backend_app.fields.JSONField(default=dict),
),
("adequation_comment", models.CharField(default="", max_length=5000)),
("integration_comment", models.CharField(default="", max_length=5000)),
(
"adequation_comment",
models.CharField(blank=True, default="", max_length=5000),
),
(
"integration_comment",
models.CharField(blank=True, default="", max_length=5000),
),
(
"adequation_grate",
models.PositiveIntegerField(
......@@ -698,8 +737,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -713,7 +752,7 @@ class Migration(migrations.Migration):
("is_anonymous", models.BooleanField(default=True)),
("is_public", models.BooleanField(default=False)),
("order_in_list", models.PositiveIntegerField()),
("comment", models.CharField(default="", max_length=5000)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
(
"grade",
models.PositiveIntegerField(
......@@ -735,8 +774,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -753,28 +792,6 @@ class Migration(migrations.Migration):
("title", models.CharField(max_length=200)),
],
),
migrations.CreateModel(
name="Semester",
fields=[
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
default=0,
validators=[
django.core.validators.MinValueValidator(0),
backend_app.models.abstract.my_model.myModel.validate_obj_model_lv,
],
),
),
(
"code",
models.CharField(max_length=6, primary_key=True, serialize=False),
),
],
options={"abstract": False},
),
migrations.CreateModel(
name="Specialty",
fields=[
......@@ -787,8 +804,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -823,8 +840,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -852,8 +869,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -865,17 +882,18 @@ class Migration(migrations.Migration):
),
),
("name", models.CharField(max_length=200)),
("acronym", models.CharField(default="", max_length=20)),
("acronym", models.CharField(blank=True, default="", max_length=20)),
(
"logo",
models.URLField(
blank=True,
default="",
validators=[
backend_app.models.university.university.validate_extension_django
],
),
),
("website", models.URLField(default="", max_length=300)),
("website", models.URLField(blank=True, default="", max_length=300)),
("utc_id", models.IntegerField(unique=True)),
],
options={"abstract": False},
......@@ -892,8 +910,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -904,8 +922,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -934,8 +952,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -946,8 +964,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -962,10 +980,14 @@ class Migration(migrations.Migration):
),
),
("type", models.CharField(max_length=200)),
("other_advantages", models.CharField(default="", max_length=5000)),
(
"other_advantages",
models.CharField(blank=True, default="", max_length=5000),
),
(
"frequency",
models.CharField(
blank=True,
choices=[
("w", "week"),
("m", "month"),
......@@ -975,6 +997,7 @@ class Migration(migrations.Migration):
],
default="m",
max_length=1,
null=True,
),
),
(
......@@ -1018,8 +1041,8 @@ class Migration(migrations.Migration):
verbose_name="ID",
),
),
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -1030,8 +1053,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -1051,8 +1074,8 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="UserData",
fields=[
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -1076,14 +1099,32 @@ class Migration(migrations.Migration):
("contact_info_is_public", models.BooleanField(default=False)),
("config", backend_app.fields.JSONField(default=dict)),
("other_data", backend_app.fields.JSONField(default=dict)),
(
"moderated_by",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
),
(
"updated_by",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to=settings.AUTH_USER_MODEL,
),
),
],
options={"abstract": False},
),
migrations.CreateModel(
name="UniversityInfo",
fields=[
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -1094,8 +1135,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -1143,8 +1184,8 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="UniversitySemestersDates",
fields=[
("moderated_on", models.DateTimeField(null=True)),
("updated_on", models.DateTimeField(null=True)),
("moderated_on", models.DateTimeField(null=True)),
(
"obj_moderation_level",
models.SmallIntegerField(
......@@ -1155,8 +1196,8 @@ class Migration(migrations.Migration):
],
),
),
("title", models.CharField(default="", max_length=150)),
("comment", models.CharField(default="", max_length=5000)),
("title", models.CharField(blank=True, default="", max_length=150)),
("comment", models.CharField(blank=True, default="", max_length=5000)),
("useful_links", backend_app.fields.JSONField(default=list)),
(
"importance_level",
......@@ -1205,35 +1246,6 @@ class Migration(migrations.Migration):
],
options={"abstract": False},
),
migrations.AddField(
model_name="userdata",
name="black_list",
field=models.ManyToManyField(
blank=True,
related_name="_userdata_black_list_+",
to="backend_app.University",
),
),