Commit 92f591e0 authored by Florent Chehab's avatar Florent Chehab
Browse files

Fixed oneToOne fields on taggedItems => ForeignKey

Cleared migrations
added LIST_SHOULD_BE_DETAIL in MyModelViewSet
cleaned get_viewset_permissions
parent a49d5f70
Pipeline #27137 passed with stages
in 2 minutes and 38 seconds
...@@ -7,13 +7,25 @@ class DictModeViewSet(viewsets.ModelViewSet): ...@@ -7,13 +7,25 @@ class DictModeViewSet(viewsets.ModelViewSet):
primary key. Instead of list. primary key. Instead of list.
""" """
BYPASS_DICT_MODE = False BYPASS_DICT_MODE = False
LIST_SHOULD_BE_DETAIL = False
def list(self, request, *args, **kwargs): def list(self, request, *args, **kwargs):
response = super(viewsets.ModelViewSet, self).list( # pylint: disable=E1003 response = super(viewsets.ModelViewSet, self).list( # pylint: disable=E1003
request, *args, **kwargs) # call the original 'list' request, *args, **kwargs) # call the original 'list'
if not self.BYPASS_DICT_MODE:
if self.LIST_SHOULD_BE_DETAIL:
if len(response.data) == 0:
response.data = dict()
elif len(response.data) == 1:
response.data = response.data[0]
else:
raise Exception(
"There should be no more than one element here check your queryset !")
elif not self.BYPASS_DICT_MODE:
pk_attr_name = self.serializer_class.Meta.model._meta.pk.name pk_attr_name = self.serializer_class.Meta.model._meta.pk.name
response.data = { response.data = {
d[pk_attr_name]: d for d in response.data d[pk_attr_name]: d for d in response.data
} }
return response return response
# Generated by Django 2.0.3 on 2018-09-04 14:38 # Generated by Django 2.0.3 on 2018-09-10 14:19
import backend.models.abstract.my_model.myModel
import backend.fields.jSONField import backend.fields.jSONField
import backend.models.abstract.my_model.myModel
import backend.models.university.university import backend.models.university.university
from django.conf import settings from django.conf import settings
import django.core.validators import django.core.validators
...@@ -14,8 +14,8 @@ class Migration(migrations.Migration): ...@@ -14,8 +14,8 @@ class Migration(migrations.Migration):
initial = True initial = True
dependencies = [ dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contenttypes', '0002_remove_content_type_name'), ('contenttypes', '0002_remove_content_type_name'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
] ]
operations = [ operations = [
...@@ -27,6 +27,7 @@ class Migration(migrations.Migration): ...@@ -27,6 +27,7 @@ class Migration(migrations.Migration):
('updated_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.models.abstract.my_model.myModel.validate_obj_model_lv])), ('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])),
('usefull_links', backend.fields.jSONField.JSONField(default=list)), ('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('is_main_campus', models.BooleanField()), ('is_main_campus', models.BooleanField()),
('name', models.CharField(max_length=200, null=True)), ('name', models.CharField(max_length=200, null=True)),
('comment', models.TextField(blank=True, null=True)), ('comment', models.TextField(blank=True, null=True)),
...@@ -34,6 +35,21 @@ class Migration(migrations.Migration): ...@@ -34,6 +35,21 @@ class Migration(migrations.Migration):
('lon', models.DecimalField(decimal_places=6, max_digits=10, validators=[django.core.validators.MinValueValidator(-180), django.core.validators.MaxValueValidator(180)])), ('lon', models.DecimalField(decimal_places=6, max_digits=10, validators=[django.core.validators.MinValueValidator(-180), django.core.validators.MaxValueValidator(180)])),
], ],
), ),
migrations.CreateModel(
name='CampusTaggedItem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('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.models.abstract.my_model.myModel.validate_obj_model_lv])),
('comment', models.TextField(blank=True)),
('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('custom_content', backend.fields.jSONField.JSONField(default=dict)),
('campus', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='campus_tagged_items', to='backend.Campus')),
('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel( migrations.CreateModel(
name='City', name='City',
fields=[ fields=[
...@@ -49,6 +65,21 @@ class Migration(migrations.Migration): ...@@ -49,6 +65,21 @@ class Migration(migrations.Migration):
'abstract': False, 'abstract': False,
}, },
), ),
migrations.CreateModel(
name='CityTaggedItem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('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.models.abstract.my_model.myModel.validate_obj_model_lv])),
('comment', models.TextField(blank=True)),
('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('custom_content', backend.fields.jSONField.JSONField(default=dict)),
('city', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='city_tagged_items', to='backend.City')),
('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel( migrations.CreateModel(
name='Country', name='Country',
fields=[ fields=[
...@@ -64,6 +95,8 @@ class Migration(migrations.Migration): ...@@ -64,6 +95,8 @@ class Migration(migrations.Migration):
('sub_region_un_code', models.CharField(blank=True, max_length=3, null=True)), ('sub_region_un_code', models.CharField(blank=True, max_length=3, null=True)),
('intermediate_region_name', models.CharField(blank=True, max_length=200, null=True)), ('intermediate_region_name', models.CharField(blank=True, max_length=200, null=True)),
('intermediate_region_un_code', models.CharField(blank=True, max_length=3, null=True)), ('intermediate_region_un_code', models.CharField(blank=True, max_length=3, null=True)),
('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={ options={
'abstract': False, 'abstract': False,
...@@ -78,6 +111,10 @@ class Migration(migrations.Migration): ...@@ -78,6 +111,10 @@ class Migration(migrations.Migration):
('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])), ('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', backend.fields.jSONField.JSONField(default=list)), ('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('country', models.ManyToManyField(related_name='country_dri', to='backend.Country')),
('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={ options={
'abstract': False, 'abstract': False,
...@@ -92,14 +129,31 @@ class Migration(migrations.Migration): ...@@ -92,14 +129,31 @@ class Migration(migrations.Migration):
('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])), ('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', backend.fields.jSONField.JSONField(default=list)), ('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('type', models.CharField(max_length=200)), ('type', models.CharField(max_length=200)),
('amount_min', models.DecimalField(decimal_places=2, max_digits=20, validators=[django.core.validators.MinValueValidator(0)])), ('amount_min', models.DecimalField(decimal_places=2, max_digits=20, validators=[django.core.validators.MinValueValidator(0)])),
('amount_max', models.DecimalField(decimal_places=2, max_digits=20, validators=[django.core.validators.MinValueValidator(0)])), ('amount_max', models.DecimalField(decimal_places=2, max_digits=20, validators=[django.core.validators.MinValueValidator(0)])),
('country', models.ManyToManyField(related_name='country_scholarships', to='backend.Country')),
], ],
options={ options={
'abstract': False, 'abstract': False,
}, },
), ),
migrations.CreateModel(
name='CountryTaggedItem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('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.models.abstract.my_model.myModel.validate_obj_model_lv])),
('comment', models.TextField(blank=True)),
('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('custom_content', backend.fields.jSONField.JSONField(default=dict)),
('country', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='country_tagged_items', to='backend.Country')),
('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel( migrations.CreateModel(
name='Currency', name='Currency',
fields=[ fields=[
...@@ -329,6 +383,7 @@ class Migration(migrations.Migration): ...@@ -329,6 +383,7 @@ class Migration(migrations.Migration):
('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])), ('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', backend.fields.jSONField.JSONField(default=list)), ('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
], ],
options={ options={
...@@ -344,6 +399,7 @@ class Migration(migrations.Migration): ...@@ -344,6 +399,7 @@ class Migration(migrations.Migration):
('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])), ('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', backend.fields.jSONField.JSONField(default=list)), ('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('type', models.CharField(max_length=200)), ('type', models.CharField(max_length=200)),
('amount_min', models.DecimalField(decimal_places=2, max_digits=20, validators=[django.core.validators.MinValueValidator(0)])), ('amount_min', models.DecimalField(decimal_places=2, max_digits=20, validators=[django.core.validators.MinValueValidator(0)])),
('amount_max', models.DecimalField(decimal_places=2, max_digits=20, validators=[django.core.validators.MinValueValidator(0)])), ('amount_max', models.DecimalField(decimal_places=2, max_digits=20, validators=[django.core.validators.MinValueValidator(0)])),
...@@ -355,59 +411,35 @@ class Migration(migrations.Migration): ...@@ -355,59 +411,35 @@ class Migration(migrations.Migration):
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='UserData', name='UniversityTaggedItem',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('moderated_on', models.DateTimeField(null=True)), ('moderated_on', models.DateTimeField(null=True)),
('updated_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.models.abstract.my_model.myModel.validate_obj_model_lv])), ('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])),
('contact_info', backend.fields.jSONField.JSONField(default=dict)), ('comment', models.TextField(blank=True)),
('contact_info_is_public', models.BooleanField(default=False)), ('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('config', backend.fields.jSONField.JSONField(default=dict)), ('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('other_data', backend.fields.jSONField.JSONField(default=dict)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='CampusTaggedItem',
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.models.abstract.my_model.myModel.validate_obj_model_lv])),
('custom_content', backend.fields.jSONField.JSONField(default=dict)),
('campus', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, primary_key=True, related_name='city_items', serialize=False, to='backend.Campus')),
('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
('tag', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='backend.Tag')),
('updated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='CityTaggedItem',
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.models.abstract.my_model.myModel.validate_obj_model_lv])),
('custom_content', backend.fields.jSONField.JSONField(default=dict)), ('custom_content', backend.fields.jSONField.JSONField(default=dict)),
('city', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, primary_key=True, related_name='city_items', serialize=False, to='backend.City')),
('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
('tag', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='backend.Tag')), ('tag', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='backend.Tag')),
('updated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
], ],
), ),
migrations.CreateModel( migrations.CreateModel(
name='CountryTaggedItem', name='UserData',
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('moderated_on', models.DateTimeField(null=True)), ('moderated_on', models.DateTimeField(null=True)),
('updated_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.models.abstract.my_model.myModel.validate_obj_model_lv])), ('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])),
('custom_content', backend.fields.jSONField.JSONField(default=dict)), ('contact_info', backend.fields.jSONField.JSONField(default=dict)),
('country', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, primary_key=True, related_name='country_items', serialize=False, to='backend.Country')), ('contact_info_is_public', models.BooleanField(default=False)),
('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ('config', backend.fields.jSONField.JSONField(default=dict)),
('tag', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='backend.Tag')), ('other_data', backend.fields.jSONField.JSONField(default=dict)),
('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( migrations.CreateModel(
name='UniversityInfo', name='UniversityInfo',
...@@ -417,6 +449,7 @@ class Migration(migrations.Migration): ...@@ -417,6 +449,7 @@ class Migration(migrations.Migration):
('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])), ('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', backend.fields.jSONField.JSONField(default=list)), ('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('university', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='university_info', serialize=False, to='backend.University')), ('university', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='university_info', serialize=False, to='backend.University')),
('cost_exchange', models.DecimalField(decimal_places=2, max_digits=20, null=True, validators=[django.core.validators.MinValueValidator(0)])), ('cost_exchange', models.DecimalField(decimal_places=2, max_digits=20, null=True, validators=[django.core.validators.MinValueValidator(0)])),
('cost_double_degree', models.DecimalField(decimal_places=2, max_digits=20, null=True, validators=[django.core.validators.MinValueValidator(0)])), ('cost_double_degree', models.DecimalField(decimal_places=2, max_digits=20, null=True, validators=[django.core.validators.MinValueValidator(0)])),
...@@ -436,6 +469,7 @@ class Migration(migrations.Migration): ...@@ -436,6 +469,7 @@ class Migration(migrations.Migration):
('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])), ('obj_moderation_level', models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.abstract.my_model.myModel.validate_obj_model_lv])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', backend.fields.jSONField.JSONField(default=list)), ('usefull_links', backend.fields.jSONField.JSONField(default=list)),
('importance_level', models.CharField(choices=[('-', 'normal'), ('+', 'important'), ('++', 'IMPORTANT')], default='-', max_length=2)),
('university', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='university_semesters_dates', serialize=False, to='backend.University')), ('university', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='university_semesters_dates', serialize=False, to='backend.University')),
('spring_begin', models.DateField(blank=True, null=True)), ('spring_begin', models.DateField(blank=True, null=True)),
('spring_end', models.DateField(blank=True, null=True)), ('spring_end', models.DateField(blank=True, null=True)),
...@@ -448,19 +482,6 @@ class Migration(migrations.Migration): ...@@ -448,19 +482,6 @@ class Migration(migrations.Migration):
'abstract': False, 'abstract': False,
}, },
), ),
migrations.CreateModel(
name='UniversityTaggedItem',
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.models.abstract.my_model.myModel.validate_obj_model_lv])),
('custom_content', backend.fields.jSONField.JSONField(default=dict)),
('university', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, primary_key=True, related_name='city_items', serialize=False, to='backend.University')),
('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
('tag', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='backend.Tag')),
('updated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField( migrations.AddField(
model_name='userdata', model_name='userdata',
name='black_list', name='black_list',
...@@ -481,10 +502,20 @@ class Migration(migrations.Migration): ...@@ -481,10 +502,20 @@ class Migration(migrations.Migration):
name='updated_by', name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
), ),
migrations.AddField(
model_name='universitytaggeditem',
name='university',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='university_tagged_items', to='backend.University'),
),
migrations.AddField(
model_name='universitytaggeditem',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField( migrations.AddField(
model_name='universityscholarship', model_name='universityscholarship',
name='university', name='university',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='univScholarship', to='backend.University'), field=models.ManyToManyField(related_name='university_scholarships', to='backend.University'),
), ),
migrations.AddField( migrations.AddField(
model_name='universityscholarship', model_name='universityscholarship',
...@@ -577,9 +608,14 @@ class Migration(migrations.Migration): ...@@ -577,9 +608,14 @@ class Migration(migrations.Migration):
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
), ),
migrations.AddField( migrations.AddField(
model_name='countryscholarship', model_name='countrytaggeditem',
name='country', name='tag',
field=models.ManyToManyField(related_name='country_scholarhip', to='backend.Country'), field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='backend.Tag'),
),
migrations.AddField(
model_name='countrytaggeditem',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
), ),
migrations.AddField( migrations.AddField(
model_name='countryscholarship', model_name='countryscholarship',
...@@ -597,27 +633,12 @@ class Migration(migrations.Migration): ...@@ -597,27 +633,12 @@ class Migration(migrations.Migration):
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
), ),
migrations.AddField( migrations.AddField(
model_name='countrydri', model_name='citytaggeditem',
name='country', name='tag',
field=models.ManyToManyField(related_name='country_dri', to='backend.Country'), field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='backend.Tag'),
),
migrations.AddField(
model_name='countrydri',
name='moderated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
), ),
migrations.AddField( migrations.AddField(
model_name='countrydri', model_name='citytaggeditem',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='country',
name='moderated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='country',
name='updated_by', name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
), ),
...@@ -636,6 +657,16 @@ class Migration(migrations.Migration): ...@@ -636,6 +657,16 @@ class Migration(migrations.Migration):
name='updated_by', name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
), ),
migrations.AddField(
model_name='campustaggeditem',
name='tag',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='backend.Tag'),
),
migrations.AddField(
model_name='campustaggeditem',
name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
),
migrations.AddField( migrations.AddField(
model_name='campus', model_name='campus',
name='city', name='city',
...@@ -649,13 +680,17 @@ class Migration(migrations.Migration): ...@@ -649,13 +680,17 @@ class Migration(migrations.Migration):
migrations.AddField( migrations.AddField(
model_name='campus', model_name='campus',
name='university', name='university',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='univ_campus', to='backend.University'), field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='university_campuses', to='backend.University'),
), ),
migrations.AddField( migrations.AddField(
model_name='campus', model_name='campus',
name='updated_by', name='updated_by',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL), field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL),
), ),
migrations.AlterUniqueTogether(
name='universitytaggeditem',
unique_together={('university', 'tag', 'importance_level')},
),
migrations.AlterUniqueTogether( migrations.AlterUniqueTogether(
name='specialty', name='specialty',
unique_together={('code', 'department')}, unique_together={('code', 'department')},
...@@ -676,24 +711,20 @@ class Migration(migrations.Migration): ...@@ -676,24 +711,20 @@ class Migration(migrations.Migration):
name='offer', name='offer',
unique_together={('semester', 'university')}, unique_together={('semester', 'university')},
), ),
migrations.AlterUniqueTogether(
name='campus',
unique_together={('is_main_campus', 'university')},
),
migrations.AlterUniqueTogether(
name='universitytaggeditem',
unique_together={('university', 'tag')},
),
migrations.AlterUniqueTogether( migrations.AlterUniqueTogether(
name='countrytaggeditem', name='countrytaggeditem',
unique_together={('country', 'tag')}, unique_together={('country', 'tag', 'importance_level')},
), ),
migrations.AlterUniqueTogether( migrations.AlterUniqueTogether(
name='citytaggeditem', name='citytaggeditem',
unique_together={('city', 'tag')}, unique_together={('city', 'tag', 'importance_level')},
), ),
migrations.AlterUniqueTogether( migrations.AlterUniqueTogether(
name='campustaggeditem', name='campustaggeditem',
unique_together={('campus', 'tag')}, unique_together={('campus', 'tag', 'importance_level')},
),
migrations.AlterUniqueTogether(
name='campus',
unique_together={('is_main_campus', 'university')},