Commit 7aeec929 authored by Florent Chehab's avatar Florent Chehab

Small update on backend texts fields

parent a0e5e515
This diff is collapsed.
# Generated by Django 2.0.3 on 2018-09-16 09:54
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='countryscholarship',
name='other_advantages',
field=models.TextField(blank=True, default=''),
),
migrations.AddField(
model_name='universityscholarship',
name='other_advantages',
field=models.TextField(blank=True, default=''),
),
migrations.AlterField(
model_name='countryscholarship',
name='amount_max',
field=models.DecimalField(decimal_places=2, max_digits=20, null=True, validators=[django.core.validators.MinValueValidator(0)]),
),
migrations.AlterField(
model_name='countryscholarship',
name='amount_min',
field=models.DecimalField(decimal_places=2, max_digits=20, null=True, validators=[django.core.validators.MinValueValidator(0)]),
),
migrations.AlterField(
model_name='countryscholarship',
name='currency',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='backend.Currency'),
),
migrations.AlterField(
model_name='universityscholarship',
name='amount_max',
field=models.DecimalField(decimal_places=2, max_digits=20, null=True, validators=[django.core.validators.MinValueValidator(0)]),
),
migrations.AlterField(
model_name='universityscholarship',
name='amount_min',
field=models.DecimalField(decimal_places=2, max_digits=20, null=True, validators=[django.core.validators.MinValueValidator(0)]),
),
migrations.AlterField(
model_name='universityscholarship',
name='currency',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='backend.Currency'),
),
]
# Generated by Django 2.0.3 on 2018-09-16 13:55
import backend.models.university.university
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
model_name='university',
name='logo',
field=models.URLField(blank=True, default='', validators=[backend.models.university.university.validate_extension_django]),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
migrations.AlterField(
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),
),
]
......@@ -12,8 +12,8 @@ IMPORTANCE_LEVEL = (
class BasicModule(MyModelVersionned):
title = models.CharField(default="", max_length=150)
comment = models.TextField(blank=True, default="")
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,
......
......@@ -17,7 +17,7 @@ class Scholarship(BasicModule):
type = models.CharField(max_length=200)
currency = models.ForeignKey(Currency, null=True, on_delete=models.PROTECT)
other_advantages = models.TextField(blank=True, default="")
other_advantages = models.CharField(default='', blank=True, max_length=5000)
frequency = models.CharField(
max_length=1,
......
from django.db import models
from backend.models.abstract.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
from backend.models.abstract.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
class Campus(MyModelVersionned):
class Campus(BasicModule):
model_config = get_model_config("Campus")
is_main_campus = models.BooleanField(null=False)
name = models.CharField(max_length=200, null=True)
comment = models.TextField(null=True, blank=True)
name = models.CharField(max_length=200, default='', blank=True)
city = models.ForeignKey(City, on_delete=models.PROTECT, null=False)
university = models.ForeignKey(
University, on_delete=models.PROTECT, null=False, related_name="university_campuses")
......@@ -41,20 +40,20 @@ class Campus(MyModelVersionned):
unique_together = ('is_main_campus', 'university')
class CampusSerializer(MyModelVersionnedSerializer):
class CampusSerializer(BasicModuleSerializer):
class Meta:
model = Campus
fields = '__all__'
class CampusViewSet(MyModelVersionnedViewSet):
class CampusViewSet(BasicModuleViewSet):
permission_classes = get_viewset_permissions("CampusViewSet")
queryset = Campus.objects.all() # pylint: disable=E1101
serializer_class = CampusSerializer
class MainCampusViewSet(MyModelVersionnedViewSet):
class MainCampusViewSet(BasicModuleViewSet):
permission_classes = get_viewset_permissions("MainCampusViewSet")
queryset = Campus.objects.filter(is_main_campus=True)
serializer_class = CampusSerializer
......@@ -8,10 +8,10 @@ class City(MyModel):
model_config = get_model_config("City")
name = models.CharField(max_length=200)
local_name = models.CharField(max_length=200, null=True, blank=True)
local_name = models.CharField(max_length=200, default='', blank=True)
# We add an area to distinguish similarly named cities
# in a country
area = models.CharField(max_length=200, null=True, blank=True)
area = models.CharField(max_length=200, default='', blank=True)
country = models.ForeignKey(Country, on_delete=models.PROTECT)
......
......@@ -10,15 +10,15 @@ class Country(MyModel):
name = models.CharField(max_length=200)
iso_alpha2_code = models.CharField(primary_key=True, max_length=2)
iso_alpha3_code = models.CharField(
unique=True, max_length=3, blank=False, null=False)
unique=True, max_length=3, default='', blank=True)
region_name = models.CharField(max_length=200)
region_un_code = models.CharField(max_length=3)
sub_region_name = models.CharField(max_length=200, null=True, blank=True)
sub_region_un_code = models.CharField(max_length=3, null=True, blank=True)
sub_region_name = models.CharField(max_length=200, default='', blank=True)
sub_region_un_code = models.CharField(max_length=3, default='', blank=True)
intermediate_region_name = models.CharField(
max_length=200, null=True, blank=True)
max_length=200, default='', blank=True)
intermediate_region_un_code = models.CharField(
max_length=3, null=True, blank=True)
max_length=3, default='', blank=True)
class CountrySerializer(MyModelSerializer):
......
......@@ -9,7 +9,7 @@ class Currency(MyModel):
code = models.CharField(primary_key=True, max_length=3)
name = models.CharField(max_length=100)
symbol = models.CharField(null=True, blank=True, max_length=30)
symbol = models.CharField(default='', blank=True, max_length=30)
one_EUR_in_this_currency = models.DecimalField(
max_digits=20,
decimal_places=6,
......
......@@ -24,10 +24,10 @@ class University(MyModel):
model_config = get_model_config("University")
name = models.CharField(max_length=200)
acronym = models.CharField(max_length=20, null=True, blank=True)
logo = models.URLField(null=True, blank=True, validators=[
acronym = models.CharField(max_length=20, default='', blank=True)
logo = models.URLField(default='', blank=True, validators=[
validate_extension_django])
website = models.URLField(null=True, blank=True, max_length=300)
website = models.URLField(default='', blank=True, max_length=300)
utc_id = models.IntegerField(unique=True)
......
......@@ -13,8 +13,8 @@ class PreviousDepartureFeedback(UserRestrictedModule):
PreviousDeparture, on_delete=models.CASCADE)
courses_and_courses_feedback = JSONField(default=dict)
adequation_comment = models.TextField()
integration_comment = models.TextField()
adequation_comment = models.CharField(default='', blank=True, max_length=5000)
integration_comment = models.CharField(default='', blank=True, max_length=5000)
adequation_grate = models.PositiveIntegerField(
validators=[MaxValueValidator(20)])
integration_grade = models.PositiveIntegerField(
......
......@@ -17,7 +17,7 @@ class Recommendation(UserRestrictedModule):
specialty = models.ForeignKey(Specialty, on_delete=models.PROTECT)
order_in_list = models.PositiveIntegerField()
comment = models.TextField(null=True, blank=True)
comment = models.CharField(default='', blank=True, max_length=5000)
grade = models.PositiveIntegerField(
null=True, validators=[MaxValueValidator(20)])
......
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