Commit a97d8933 authored by Florent Chehab's avatar Florent Chehab
Browse files

Merge branch 'centralized_viewset_permissions' into 'master'

Centralized viewset permissions, added obj_moderation_level [not tested], cleaning

See merge request chehabfl/outgoing_rex!25
parents e9e8ecbe 108fa917
Pipeline #26855 passed with stages
in 2 minutes and 47 seconds
...@@ -5,7 +5,7 @@ install_backend: ...@@ -5,7 +5,7 @@ install_backend:
pip install -r requirements.txt --quiet pip install -r requirements.txt --quiet
generate_backend: generate_backend:
python ./backend/generate/generate_all.py export PYTHONPATH=$$PWD ; python ./backend/generate/generate_all.py
generate_frontend: generate_frontend:
python ./frontend/generate/generate_frontend_files.py python ./frontend/generate/generate_frontend_files.py
......
##### #####
# This python file is used to generate js files for redux # This python file is used to generate js files for redux
from django import template from django import template
import yaml
from os.path import join, realpath, dirname from os.path import join, realpath, dirname
from general.api import get_api_config
############ ############
# Need to do this first so that Django template engine is working # Need to do this first so that Django template engine is working
...@@ -44,7 +44,7 @@ saving_dir = realpath(current_dir + "/../") ...@@ -44,7 +44,7 @@ saving_dir = realpath(current_dir + "/../")
# API_BASE = "http://127.0.0.1:8000/api/" # API_BASE = "http://127.0.0.1:8000/api/"
api_config = yaml.load(read_file(join(current_dir, 'api_config.yml'))) api_config = get_api_config()
# Render urls.py # Render urls.py
template_path = join(templates_dir, 'urls.tpl') template_path = join(templates_dir, 'urls.tpl')
......
...@@ -9,11 +9,18 @@ from django.conf.urls import url, include ...@@ -9,11 +9,18 @@ from django.conf.urls import url, include
from django.conf import settings from django.conf import settings
from rest_framework import routers from rest_framework import routers
{% spaceless %} ALL_MODELS = []
{% for model in data %}{% if 'requires_testing' not in model or not model.requires_testing %} ALL_VIEWSETS = []
{% for model in data %}
{% if not model.requires_testing %}
from backend.models.{{model.import_location}} import {{model.viewset}} from backend.models.{{model.import_location}} import {{model.viewset}}
{% endif %}{% endfor %} ALL_VIEWSETS.append({{model.viewset}})
{% endspaceless %} {% if model.model is not None and not model.ignore_in_admin%}
from backend.models.{{model.import_location}} import {{model.model}}
ALL_MODELS.append({{model.model}})
{% endif %}
{% endif %}
{% endfor %}
from rest_framework.documentation import include_docs_urls from rest_framework.documentation import include_docs_urls
...@@ -24,19 +31,37 @@ urlpatterns = [ ...@@ -24,19 +31,37 @@ urlpatterns = [
router = routers.DefaultRouter() router = routers.DefaultRouter()
if settings.TESTING: if settings.TESTING:
{% for model in data %}{% if 'requires_testing' in model or model.requires_testing %} {% for model in data %}{% if model.requires_testing %}
from backend.models.{{model.import_location}} import {{model.viewset}} from backend.models.{{model.import_location}} import {{model.viewset}}
ALL_VIEWSETS.append({{model.viewset}})
{% if model.model is not None %}
from backend.models.{{model.import_location}} import {{model.model}}
ALL_MODELS.append({{model.model}})
{% endif %}
router.register( router.register(
r'{{model.api_end_point}}{% if 'api_attr' in model %}/{{model.api_attr}}{% endif %}', r'{{model.api_end_point}}{% if 'api_attr' in model %}/{{model.api_attr}}{% endif %}',
{{model.viewset}}{%if 'api_name' in model%},"{{model.api_name}}"{% endif %} {{model.viewset}}{%if 'api_name' in model%},"{{model.api_name}}"{% endif %}
){% endif %}{% endfor %} ){% endif %}{% endfor %}
{% for model in data %}{% if 'requires_testing' not in model or not model.requires_testing %} {% for model in data %}{% if not model.requires_testing %}
router.register( router.register(
r'{{model.api_end_point}}{% if 'api_attr' in model %}/{{model.api_attr}}{% endif %}', r'{{model.api_end_point}}{% if 'api_attr' in model %}/{{model.api_attr}}{% endif %}',
{{model.viewset}}{%if 'api_name' in model%},"{{model.api_name}}"{% endif %} {{model.viewset}}{%if 'api_name' in model%},"{{model.api_name}}"{% endif %}
){% endif %}{% endfor %} ){% endif %}{% endfor %}
urlpatterns += [url(r'^api/', include(router.urls))] urlpatterns += [url(r'^api/', include(router.urls))]
for model in ALL_MODELS:
for key in model.model_config:
val = model.model_config[key]
if val is None:
raise Exception("You forgot to set the {} config variable in the model {}".format(key, str(model)))
from backend.permissions import DEFAULT_VIEWSET_PERMISSIONS
for viewset in ALL_VIEWSETS:
for p in DEFAULT_VIEWSET_PERMISSIONS:
v_p = viewset.permission_classes
if p not in v_p:
raise Exception("Permission_classes are not defined correctly in the viewset {}".format(str(viewset)))
{% endautoescape %} {% endautoescape %}
# Generated by Django 2.0.3 on 2018-09-01 13:18 # Generated by Django 2.0.3 on 2018-09-02 14:42
import backend.utils.friendly_path import backend.utils.friendly_path
from django.conf import settings from django.conf import settings
...@@ -24,6 +24,7 @@ class Migration(migrations.Migration): ...@@ -24,6 +24,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)), ('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)),
('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)),
...@@ -38,6 +39,7 @@ class Migration(migrations.Migration): ...@@ -38,6 +39,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('name', models.CharField(max_length=200)), ('name', models.CharField(max_length=200)),
('local_name', models.CharField(blank=True, max_length=200, null=True)), ('local_name', models.CharField(blank=True, max_length=200, null=True)),
('area', models.CharField(blank=True, max_length=200, null=True)), ('area', models.CharField(blank=True, max_length=200, null=True)),
...@@ -51,6 +53,7 @@ class Migration(migrations.Migration): ...@@ -51,6 +53,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('name', models.CharField(max_length=200)), ('name', models.CharField(max_length=200)),
('iso_alpha2_code', models.CharField(max_length=2, primary_key=True, serialize=False)), ('iso_alpha2_code', models.CharField(max_length=2, primary_key=True, serialize=False)),
('iso_alpha3_code', models.CharField(max_length=3, unique=True)), ('iso_alpha3_code', models.CharField(max_length=3, unique=True)),
...@@ -71,6 +74,7 @@ class Migration(migrations.Migration): ...@@ -71,6 +74,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)), ('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)),
], ],
...@@ -84,6 +88,7 @@ class Migration(migrations.Migration): ...@@ -84,6 +88,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)), ('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)),
('type', models.CharField(max_length=200)), ('type', models.CharField(max_length=200)),
...@@ -99,6 +104,7 @@ class Migration(migrations.Migration): ...@@ -99,6 +104,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('code', models.CharField(max_length=3, primary_key=True, serialize=False)), ('code', models.CharField(max_length=3, primary_key=True, serialize=False)),
('name', models.CharField(max_length=100)), ('name', models.CharField(max_length=100)),
('symbol', models.CharField(blank=True, max_length=30, null=True)), ('symbol', models.CharField(blank=True, max_length=30, null=True)),
...@@ -115,6 +121,7 @@ class Migration(migrations.Migration): ...@@ -115,6 +121,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('code', models.CharField(max_length=6, primary_key=True, serialize=False)), ('code', models.CharField(max_length=6, primary_key=True, serialize=False)),
('name', models.CharField(max_length=100)), ('name', models.CharField(max_length=100)),
('active', models.BooleanField()), ('active', models.BooleanField()),
...@@ -131,6 +138,7 @@ class Migration(migrations.Migration): ...@@ -131,6 +138,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('aaa', models.CharField(max_length=100)), ('aaa', models.CharField(max_length=100)),
('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)),
('updated_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)),
...@@ -145,6 +153,7 @@ class Migration(migrations.Migration): ...@@ -145,6 +153,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('bbb', models.CharField(max_length=100)), ('bbb', models.CharField(max_length=100)),
('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)),
('updated_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)),
...@@ -159,6 +168,7 @@ class Migration(migrations.Migration): ...@@ -159,6 +168,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('nb_seats_offered', models.PositiveIntegerField()), ('nb_seats_offered', models.PositiveIntegerField()),
('nb_seats_offered_exchange', models.PositiveIntegerField(null=True)), ('nb_seats_offered_exchange', models.PositiveIntegerField(null=True)),
('nb_seats_offered_double_degree', models.PositiveIntegerField(null=True)), ('nb_seats_offered_double_degree', models.PositiveIntegerField(null=True)),
...@@ -182,6 +192,7 @@ class Migration(migrations.Migration): ...@@ -182,6 +192,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('Utc_departure_id', models.IntegerField()), ('Utc_departure_id', models.IntegerField()),
('is_anonymous', models.BooleanField()), ('is_anonymous', models.BooleanField()),
('courses', django.contrib.postgres.fields.jsonb.JSONField(null=True)), ('courses', django.contrib.postgres.fields.jsonb.JSONField(null=True)),
...@@ -197,6 +208,7 @@ class Migration(migrations.Migration): ...@@ -197,6 +208,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('is_anonymous', models.BooleanField(default=True)), ('is_anonymous', models.BooleanField(default=True)),
('is_public', models.BooleanField(default=False)), ('is_public', models.BooleanField(default=False)),
('courses_and_courses_feedback', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), ('courses_and_courses_feedback', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
...@@ -219,6 +231,7 @@ class Migration(migrations.Migration): ...@@ -219,6 +231,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('is_anonymous', models.BooleanField(default=True)), ('is_anonymous', models.BooleanField(default=True)),
('is_public', models.BooleanField(default=False)), ('is_public', models.BooleanField(default=False)),
('order_in_list', models.PositiveIntegerField()), ('order_in_list', models.PositiveIntegerField()),
...@@ -234,6 +247,7 @@ class Migration(migrations.Migration): ...@@ -234,6 +247,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('is_anonymous', models.BooleanField(default=True)), ('is_anonymous', models.BooleanField(default=True)),
('is_public', models.BooleanField(default=False)), ('is_public', models.BooleanField(default=False)),
('public', models.BooleanField()), ('public', models.BooleanField()),
...@@ -248,6 +262,7 @@ class Migration(migrations.Migration): ...@@ -248,6 +262,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('code', models.CharField(max_length=6, primary_key=True, serialize=False)), ('code', models.CharField(max_length=6, primary_key=True, serialize=False)),
('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)),
('updated_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)),
...@@ -262,6 +277,7 @@ class Migration(migrations.Migration): ...@@ -262,6 +277,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('code', models.CharField(max_length=6)), ('code', models.CharField(max_length=6)),
('name', models.CharField(max_length=100)), ('name', models.CharField(max_length=100)),
('active', models.BooleanField()), ('active', models.BooleanField()),
...@@ -276,6 +292,7 @@ class Migration(migrations.Migration): ...@@ -276,6 +292,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('name', models.CharField(max_length=100, unique=True)), ('name', models.CharField(max_length=100, unique=True)),
('config', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict)), ('config', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict)),
('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)),
...@@ -291,6 +308,7 @@ class Migration(migrations.Migration): ...@@ -291,6 +308,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('name', models.CharField(max_length=200)), ('name', models.CharField(max_length=200)),
('acronym', models.CharField(blank=True, max_length=20, null=True)), ('acronym', models.CharField(blank=True, max_length=20, null=True)),
('logo', models.ImageField(default='path/to/my/default/image.jpg', max_length=250, upload_to=backend.utils.friendly_path.friendly_path('uploads/universities/logos/', 'name'))), ('logo', models.ImageField(default='path/to/my/default/image.jpg', max_length=250, upload_to=backend.utils.friendly_path.friendly_path('uploads/universities/logos/', 'name'))),
...@@ -306,6 +324,7 @@ class Migration(migrations.Migration): ...@@ -306,6 +324,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)), ('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)),
('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)),
...@@ -320,6 +339,7 @@ class Migration(migrations.Migration): ...@@ -320,6 +339,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)), ('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)),
('type', models.CharField(max_length=200)), ('type', models.CharField(max_length=200)),
...@@ -338,6 +358,7 @@ class Migration(migrations.Migration): ...@@ -338,6 +358,7 @@ class Migration(migrations.Migration):
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('contact_info', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), ('contact_info', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
('contact_info_is_public', models.BooleanField(default=False)), ('contact_info_is_public', models.BooleanField(default=False)),
('config', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), ('config', django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
...@@ -352,6 +373,7 @@ class Migration(migrations.Migration): ...@@ -352,6 +373,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('custom_content', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), ('custom_content', django.contrib.postgres.fields.jsonb.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')), ('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)), ('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
...@@ -364,6 +386,7 @@ class Migration(migrations.Migration): ...@@ -364,6 +386,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('custom_content', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), ('custom_content', django.contrib.postgres.fields.jsonb.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')), ('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)),
...@@ -376,6 +399,7 @@ class Migration(migrations.Migration): ...@@ -376,6 +399,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('custom_content', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), ('custom_content', django.contrib.postgres.fields.jsonb.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')), ('country', models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, primary_key=True, related_name='country_items', serialize=False, to='backend.Country')),
('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)),
...@@ -388,6 +412,7 @@ class Migration(migrations.Migration): ...@@ -388,6 +412,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)), ('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)),
('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')),
...@@ -406,6 +431,7 @@ class Migration(migrations.Migration): ...@@ -406,6 +431,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('comment', models.TextField(blank=True)), ('comment', models.TextField(blank=True)),
('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)), ('usefull_links', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list)),
('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')),
...@@ -425,6 +451,7 @@ class Migration(migrations.Migration): ...@@ -425,6 +451,7 @@ class Migration(migrations.Migration):
fields=[ fields=[
('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=3, validators=[django.core.validators.MinValueValidator(0)])),
('custom_content', django.contrib.postgres.fields.jsonb.JSONField(default=dict)), ('custom_content', django.contrib.postgres.fields.jsonb.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')), ('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)), ('moderated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
......
# Generated by Django 2.0.3 on 2018-09-02 15:16
import backend.models.my_model.myModel
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='campus',
name='obj_moderation_level',
field=models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.my_model.myModel.validate_obj_model_lv]),
),
migrations.AlterField(
model_name='campustaggeditem',
name='obj_moderation_level',
field=models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.my_model.myModel.validate_obj_model_lv]),
),
migrations.AlterField(
model_name='city',
name='obj_moderation_level',
field=models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.my_model.myModel.validate_obj_model_lv]),
),
migrations.AlterField(
model_name='citytaggeditem',
name='obj_moderation_level',
field=models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.my_model.myModel.validate_obj_model_lv]),
),
migrations.AlterField(
model_name='country',
name='obj_moderation_level',
field=models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.my_model.myModel.validate_obj_model_lv]),
),
migrations.AlterField(
model_name='countrydri',
name='obj_moderation_level',
field=models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.my_model.myModel.validate_obj_model_lv]),
),
migrations.AlterField(
model_name='countryscholarship',
name='obj_moderation_level',
field=models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.my_model.myModel.validate_obj_model_lv]),
),
migrations.AlterField(
model_name='countrytaggeditem',
name='obj_moderation_level',
field=models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.my_model.myModel.validate_obj_model_lv]),
),
migrations.AlterField(
model_name='currency',
name='obj_moderation_level',
field=models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.my_model.myModel.validate_obj_model_lv]),
),
migrations.AlterField(
model_name='department',
name='obj_moderation_level',
field=models.SmallIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), backend.models.my_model.myModel.validate_obj_model_lv]),
),