Commit 9e4abdc1 authored by Florent Chehab's avatar Florent Chehab

Migrations cleaned and changed some models

parent d7857613
Pipeline #27350 passed with stages
in 2 minutes and 33 seconds
This diff is collapsed.
# Generated by Django 2.0.3 on 2018-09-10 15:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='campustaggeditem',
name='title',
field=models.CharField(default='', max_length=150),
),
migrations.AddField(
model_name='citytaggeditem',
name='title',
field=models.CharField(default='', max_length=150),
),
migrations.AddField(
model_name='countrytaggeditem',
name='title',
field=models.CharField(default='', max_length=150),
),
migrations.AddField(
model_name='universitytaggeditem',
name='title',
field=models.CharField(default='', max_length=150),
),
]
# Generated by Django 2.0.3 on 2018-09-10 15:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0002_auto_20180910_1700'),
]
operations = [
migrations.AlterField(
model_name='campustaggeditem',
name='comment',
field=models.TextField(blank=True, default=''),
),
migrations.AlterField(
model_name='citytaggeditem',
name='comment',
field=models.TextField(blank=True, default=''),
),
migrations.AlterField(
model_name='countrydri',
name='comment',
field=models.TextField(blank=True, default=''),
),
migrations.AlterField(
model_name='countryscholarship',
name='comment',
field=models.TextField(blank=True, default=''),
),
migrations.AlterField(
model_name='countrytaggeditem',
name='comment',
field=models.TextField(blank=True, default=''),
),
migrations.AlterField(
model_name='universitydri',
name='comment',
field=models.TextField(blank=True, default=''),
),
migrations.AlterField(
model_name='universityinfo',
name='comment',
field=models.TextField(blank=True, default=''),
),
migrations.AlterField(
model_name='universityscholarship',
name='comment',
field=models.TextField(blank=True, default=''),
),
migrations.AlterField(
model_name='universitysemestersdates',
name='comment',
field=models.TextField(blank=True, default=''),
),
migrations.AlterField(
model_name='universitytaggeditem',
name='comment',
field=models.TextField(blank=True, default=''),
),
]
# Generated by Django 2.0.3 on 2018-09-10 16:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0003_auto_20180910_1731'),
]
operations = [
migrations.AlterField(
model_name='universityinfo',
name='costs_currency',
field=models.ForeignKey(default='EUR', on_delete=django.db.models.deletion.PROTECT, to='backend.Currency'),
),
]
# Generated by Django 2.0.3 on 2018-09-10 16:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0004_auto_20180910_1834'),
]
operations = [
migrations.AddField(
model_name='countryscholarship',
name='frequency',
field=models.CharField(choices=[('w', 'week'), ('m', 'month'), ('s', 'semester'), ('y', 'year'), ('o', 'one_shot')], default='m', max_length=1),
),
migrations.AddField(
model_name='universityscholarship',
name='frequency',
field=models.CharField(choices=[('w', 'week'), ('m', 'month'), ('s', 'semester'), ('y', 'year'), ('o', 'one_shot')], default='m', max_length=1),
),
]
# Generated by Django 2.0.3 on 2018-09-10 19:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('backend', '0005_auto_20180910_1846'),
]
operations = [
migrations.RenameField(
model_name='countrydri',
old_name='country',
new_name='countries',
),
migrations.RenameField(
model_name='countryscholarship',
old_name='country',
new_name='countries',
),
migrations.RenameField(
model_name='offer',
old_name='specialty',
new_name='specialties',
),
migrations.RenameField(
model_name='universitydri',
old_name='university',
new_name='universities',
),
migrations.RenameField(
model_name='universityscholarship',
old_name='university',
new_name='universities',
),
]
# Generated by Django 2.0.3 on 2018-09-11 09:14
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0006_auto_20180910_2144'),
]
operations = [
migrations.RemoveField(
model_name='userdata',
name='id',
),
migrations.AlterField(
model_name='userdata',
name='owner',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL),
),
]
# Generated by Django 2.0.3 on 2018-09-11 09:47
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0007_auto_20180911_1114'),
]
operations = [
migrations.AlterField(
model_name='universityinfo',
name='costs_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-11 14:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('backend', '0008_auto_20180911_1147'),
]
operations = [
migrations.RenameField(
model_name='campus',
old_name='usefull_links',
new_name='useful_links',
),
migrations.RenameField(
model_name='campustaggeditem',
old_name='usefull_links',
new_name='useful_links',
),
migrations.RenameField(
model_name='citytaggeditem',
old_name='usefull_links',
new_name='useful_links',
),
migrations.RenameField(
model_name='countrydri',
old_name='usefull_links',
new_name='useful_links',
),
migrations.RenameField(
model_name='countryscholarship',
old_name='usefull_links',
new_name='useful_links',
),
migrations.RenameField(
model_name='countrytaggeditem',
old_name='usefull_links',
new_name='useful_links',
),
migrations.RenameField(
model_name='universitydri',
old_name='usefull_links',
new_name='useful_links',
),
migrations.RenameField(
model_name='universityinfo',
old_name='usefull_links',
new_name='useful_links',
),
migrations.RenameField(
model_name='universityscholarship',
old_name='usefull_links',
new_name='useful_links',
),
migrations.RenameField(
model_name='universitysemestersdates',
old_name='usefull_links',
new_name='useful_links',
),
migrations.RenameField(
model_name='universitytaggeditem',
old_name='usefull_links',
new_name='useful_links',
),
]
......@@ -12,7 +12,7 @@ IMPORTANCE_LEVEL = (
class BasicModule(MyModelVersionned):
title = models.CharField(default="", max_length=150)
comment = models.TextField(blank=True, default="")
useful_links = JSONField(default=list)
importance_level = models.CharField(
......
......@@ -7,7 +7,6 @@ from backend.fields import JSONField
class TaggedItem(BasicModule):
tag = models.ForeignKey(Tag, related_name='+', on_delete=models.PROTECT)
title = models.CharField(default="", max_length=150)
custom_content = JSONField(default=dict)
class Meta:
......
from django.db import models
from backend.models.abstract.basic_module import BasicModule, BasicModuleSerializer, BasicModuleViewSet
from backend.models.abstract.my_model import MyModelVersionned, MyModelVersionnedSerializer, MyModelVersionnedViewSet
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(BasicModule):
class Campus(MyModelVersionned):
model_config = get_model_config("Campus")
is_main_campus = models.BooleanField(null=False)
......@@ -41,20 +41,20 @@ class Campus(BasicModule):
unique_together = ('is_main_campus', 'university')
class CampusSerializer(BasicModuleSerializer):
class CampusSerializer(MyModelVersionnedSerializer):
class Meta:
model = Campus
fields = '__all__'
class CampusViewSet(BasicModuleViewSet):
class CampusViewSet(MyModelVersionnedViewSet):
permission_classes = get_viewset_permissions("CampusViewSet")
queryset = Campus.objects.all() # pylint: disable=E1101
serializer_class = CampusSerializer
class MainCampusViewSet(BasicModuleViewSet):
class MainCampusViewSet(MyModelVersionnedViewSet):
permission_classes = get_viewset_permissions("MainCampusViewSet")
queryset = Campus.objects.filter(is_main_campus=True)
serializer_class = CampusSerializer
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