Gitlab CSE Unil

Commit 4a99dfdd authored by M. Chardon's avatar M. Chardon
Browse files

maj django 2.2

parent 11d718b9
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import adim.models.annotables
import jsonfield.fields
from django.conf import settings
import autoslug.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Annotation',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('item', models.TextField(verbose_name='Paper.js item')),
('order', models.IntegerField(default=0, verbose_name='ordre')),
('comment', models.CharField(default='', max_length=512, verbose_name='comment', blank=True)),
('creation_date', models.DateTimeField(auto_now_add=True)),
('modification_date', models.DateTimeField(auto_now=True)),
],
options={
'ordering': ('owner__id', '-order', 'modification_date'),
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AnObj',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('uuid', models.CharField(unique=True, max_length=32, blank=True)),
('name', models.CharField(max_length=125)),
('locked', models.BooleanField(default=False, verbose_name='locked')),
('sharing_mode', models.IntegerField(default=0, verbose_name='sharing mode', blank=True)),
('sharing_opts', jsonfield.fields.JSONField(default='{}', verbose_name='sharing options', blank=True)),
('allow_public_publishing', models.BooleanField(default=False, verbose_name='allow public publishing')),
('image', models.ImageField(upload_to=adim.models.annotables.get_image_path, null=True, verbose_name='image', blank=True)),
('image_url', models.CharField(default='', max_length=512, null=True, verbose_name='image url', blank=True)),
('_thumb_url', models.CharField(max_length=512, null=True, blank=True)),
],
options={
'ordering': ['-id'],
'verbose_name': 'Annotable Object',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AnObjMembership',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('publish_mode', models.IntegerField(default=0, choices=[(0, 'private'), (1, 'owner only'), (2, 'all members')])),
('anobj', models.ForeignKey(to='adim.AnObj')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'Annotable Object Membership',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AOAttribute',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('entity_id', models.IntegerField()),
('value_text', models.TextField(null=True, blank=True)),
('value_float', models.FloatField(null=True, blank=True)),
('value_date', models.DateField(null=True, blank=True)),
('value_bool', models.NullBooleanField()),
('value_range_min', models.FloatField(null=True, blank=True)),
('value_range_max', models.FloatField(null=True, blank=True)),
('value_image', models.ImageField(null=True, upload_to='ao', blank=True)),
],
options={
'verbose_name': 'Annotable Object Attribute',
'verbose_name_plural': 'Annotable Object Attributes',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AOChoice',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(max_length=100)),
],
options={
'verbose_name': 'Annotable Object Choice',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AOSchema',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('title', models.CharField(help_text='user-friendly attribute name', max_length=250, verbose_name='title')),
('name', autoslug.fields.AutoSlugField(max_length=250, verbose_name='name', blank=True)),
('help_text', models.CharField(help_text='short description for administrator', max_length=250, verbose_name='help text', blank=True)),
('datatype', models.CharField(max_length=5, verbose_name='data type', choices=[(b'text', 'text'), (b'float', 'number'), (b'date', 'date'), (b'bool', 'boolean'), (b'one', 'choice'), (b'many', 'multiple choices'), (b'range', 'numeric range')])),
('required', models.BooleanField(default=False, verbose_name='required')),
('searched', models.BooleanField(default=False, verbose_name='include in search')),
('filtered', models.BooleanField(default=False, verbose_name='include in filters')),
('sortable', models.BooleanField(default=False, verbose_name='allow sorting')),
],
options={
'verbose_name': 'Annotable Object Schema',
'verbose_name_plural': 'Annotable Object Schemata',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AOType',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=128)),
('title', models.CharField(default='', max_length=512, blank=True)),
],
options={
'verbose_name': 'Annotable Object Type',
},
bases=(models.Model,),
),
migrations.AddField(
model_name='aoschema',
name='ao_types',
field=models.ManyToManyField(to='adim.AOType', null=True, blank=True),
preserve_default=True,
),
migrations.AddField(
model_name='aochoice',
name='schema',
field=models.ForeignKey(related_name='choices', to='adim.AOSchema'),
preserve_default=True,
),
migrations.AddField(
model_name='aoattribute',
name='choice',
field=models.ForeignKey(blank=True, to='adim.AOChoice', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='aoattribute',
name='entity_type',
field=models.ForeignKey(to='contenttypes.ContentType'),
preserve_default=True,
),
migrations.AddField(
model_name='aoattribute',
name='schema',
field=models.ForeignKey(related_name='attrs', to='adim.AOSchema'),
preserve_default=True,
),
migrations.AddField(
model_name='anobj',
name='ao_type',
field=models.ForeignKey(verbose_name='type', blank=True, to='adim.AOType', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='anobj',
name='members',
field=models.ManyToManyField(related_name='shared_anobjs', to=settings.AUTH_USER_MODEL, through='adim.AnObjMembership', blank=True, null=True, verbose_name='members'),
preserve_default=True,
),
migrations.AddField(
model_name='anobj',
name='owner',
field=models.ForeignKey(related_name='anobjs', verbose_name='owner', to=settings.AUTH_USER_MODEL),
preserve_default=True,
),
migrations.AddField(
model_name='annotation',
name='annotable',
field=models.ForeignKey(related_name='annotations', verbose_name='annotable', to='adim.AnObj'),
preserve_default=True,
),
migrations.AddField(
model_name='annotation',
name='owner',
field=models.ForeignKey(verbose_name='owner', to=settings.AUTH_USER_MODEL),
preserve_default=True,
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('adim', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='anobj',
name='ao_type',
),
migrations.AlterField(
model_name='anobj',
name='members',
field=models.ManyToManyField(related_name='shared_anobjs', verbose_name='members', to=settings.AUTH_USER_MODEL, through='adim.AnObjMembership', blank=True),
),
migrations.AlterField(
model_name='aoschema',
name='ao_types',
field=models.ManyToManyField(to='adim.AOType', blank=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('adim', '0002_auto_20150417_1302'),
]
operations = [
migrations.AddField(
model_name='anobj',
name='owners',
field=models.ManyToManyField(related_name='owned_anobjs', verbose_name='owners', to=settings.AUTH_USER_MODEL, blank=True),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def init_owners(apps, schema_editor):
"""
Initialize new `owners` field by adding the current `owner` to it
:param apps:
:param schema_editor:
:return:
"""
AnObj = apps.get_model("adim", "AnObj")
for anobj in AnObj.objects.all():
if len(anobj.owners.all()) == 0:
anobj.owners.add(anobj.owner)
class Migration(migrations.Migration):
dependencies = [
('adim', '0003_anobj_owners'),
]
operations = [
migrations.RunPython(init_owners),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('adim', '0004_auto_20150424_1209'),
]
operations = [
migrations.AddField(
model_name='anobj',
name='env',
field=models.CharField(blank=True, max_length=64, choices=[('', 'Standard'), ('cimaf', 'CIMAF')]),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('adim', '0005_anobj_env'),
]
operations = [
migrations.CreateModel(
name='EnvParam',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('cimaf_cut_pos', models.IntegerField(null=True, blank=True)),
('cimaf_cut_margin', models.IntegerField(null=True, blank=True)),
('anobj', models.OneToOneField(to='adim.AnObj')),
],
options={
'verbose_name': 'Environment params',
},
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('adim', '0006_envparam'),
]
operations = [
migrations.AddField(
model_name='envparam',
name='categories_set',
field=models.CharField(max_length=64, blank=True),
),
migrations.AlterField(
model_name='anobj',
name='env',
field=models.CharField(blank=True, max_length=64, choices=[('', 'Standard'), ('cimaf', 'CIMAF'), ('playground', 'Pour Voir')]),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('adim', '0007_auto_20150714_0815'),
]
operations = [
migrations.RenameField(
model_name='envparam',
old_name='categories_set',
new_name='category_set_name',
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('adim', '0008_auto_20150714_0817'),
]
operations = [
migrations.AlterModelOptions(
name='envparam',
options={'verbose_name': 'Environment params', 'permissions': (('set_env_cimaf', 'Set CIMAF environment'),)},
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('adim', '0009_auto_20150715_1144'),
]
operations = [
migrations.AlterModelOptions(
name='envparam',
options={'verbose_name': 'Environment params', 'permissions': (('set_env_cimaf', 'Set CIMAF environment'), ('set_env_playground', 'Set PlayGround environment'))},
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('adim', '0010_auto_20150715_1252'),
]
operations = [
migrations.AlterField(
model_name='anobj',
name='env',
field=models.CharField(blank=True, max_length=64, choices=[('', 'Standard'), ('cimaf', 'CIMAF'), ('anodate', 'Datation')]),
),
]
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('adim', '0011_auto_20150716_0911'),
]
operations = [
migrations.AlterModelOptions(
name='envparam',
options={'verbose_name': 'Environment params', 'permissions': (('set_env_cimaf', 'Set CIMAF environment'), ('set_env_anodate', 'Set Anodate environment'))},
),
]
......@@ -13,17 +13,17 @@ from adim.views import AnObjViewSet, UAnObjViewSet, SharedAnObjViewSet, Annotati
d_router = DefaultRouter()
router = routers.SimpleRouter()
router.register(r'anobjs', AnObjViewSet, base_name='anobjs')
router.register(r'uanobjs', UAnObjViewSet, base_name='uanobjs')
router.register(r'shared/anobjs', SharedAnObjViewSet, base_name='shared-anobjs')
router.register(r'annotations', AnnotationViewSet, base_name='annotations')
router.register(r'users', UserViewSet, base_name='users')
router.register(r'anobjs', AnObjViewSet, basename='anobjs')
router.register(r'uanobjs', UAnObjViewSet, basename='uanobjs')
router.register(r'shared/anobjs', SharedAnObjViewSet, basename='shared-anobjs')
router.register(r'annotations', AnnotationViewSet, basename='annotations')
router.register(r'users', UserViewSet, basename='users')
annot_router = routers.NestedSimpleRouter(router, r'anobjs', lookup='anobjs')
annot_router.register(r'shared/annotations', SharedAnnotationViewSet, base_name='shared-annotations')
annot_router.register(r'shared/annotations', SharedAnnotationViewSet, basename='shared-annotations')
sh_annot_router = routers.NestedSimpleRouter(router, r'shared/anobjs', lookup='anobjs')
sh_annot_router.register(r'shared/annotations', SharedAnnotationViewSet, base_name='shared-annotations-2')
sh_annot_router.register(r'shared/annotations', SharedAnnotationViewSet, basename='shared-annotations-2')
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browseable API.
......
......@@ -12,7 +12,7 @@ from adim.serializers import AnObjSerializer, SharedAnObjSerializer, AnObjListSe
from adim.permissions import has_anobj_access
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import detail_route
from rest_framework.decorators import action
from rest_framework.permissions import BasePermission, SAFE_METHODS
......@@ -115,7 +115,7 @@ class AnObjViewSet(viewsets.ModelViewSet):
return AnObj.objects.select_related('envparam').filter(q).distinct()
@detail_route(methods=['get', 'patch', 'post', 'delete'])
@action(detail=True, methods=['get', 'patch', 'post', 'delete'])
def members(self, request, pk=None):
anobj = self.get_object()
......@@ -152,7 +152,7 @@ class AnObjViewSet(viewsets.ModelViewSet):
return Response({'users': UserSerializer(instance=anobj.members.all(), many=True).data})
@detail_route(methods=['patch'])
@action(detail=True, methods=['patch'])
def set_publish_mode(self, request, pk=None):
user = request.user
anobj = AnObj.objects.get(pk=pk)
......@@ -178,7 +178,7 @@ class AnObjViewSet(viewsets.ModelViewSet):
return Response({'publish_mode': membership.publish_mode})
@detail_route(methods=['patch'])
@action(detail=True, methods=['patch'])
def env_param(self, request, pk=None):
pass
......@@ -220,7 +220,7 @@ class SharedAnObjViewSet(AnObjViewSet):
return AnObj.objects.filter(q).distinct()
@detail_route(methods=['get'])
@action(detail=True, methods=['get'])
def members(self, request, pk=None):
anobj = self.get_object()
if anobj.allow_public_publishing:
......
3d_rotation e84d
ac_unit eb3b
access_alarm e190
access_alarms e191
access_time e192
accessibility e84e
accessible e914
account_balance e84f
account_balance_wallet e850
account_box e851
account_circle e853
adb e60e
add e145
add_a_photo e439
add_alarm e193
add_alert e003
add_box e146
add_circle e147
add_circle_outline e148
add_location e567
add_shopping_cart e854
add_to_photos e39d
add_to_queue e05c
adjust e39e
airline_seat_flat e630
airline_seat_flat_angled e631
airline_seat_individual_suite e632
airline_seat_legroom_extra e633
airline_seat_legroom_normal e634
airline_seat_legroom_reduced e635
airline_seat_recline_extra e636
airline_seat_recline_normal e637
airplanemode_active e195
airplanemode_inactive e194
airplay e055
airport_shuttle eb3c
alarm e855
alarm_add e856
alarm_off e857
alarm_on e858
album e019
all_inclusive eb3d
all_out e90b
android e859
announcement e85a
apps e5c3
archive e149
arrow_back e5c4
arrow_downward e5db
arrow_drop_down e5c5
arrow_drop_down_circle e5c6
arrow_drop_up e5c7
arrow_forward e5c8
arrow_upward e5d8
art_track e060
aspect_ratio e85b
assessment e85c
assignment e85d
assignment_ind e85e
assignment_late e85f
assignment_return e860
assignment_returned e861
assignment_turned_in e862
assistant e39f
assistant_photo e3a0
attach_file e226
attach_money e227
attachment e2bc
audiotrack e3a1
autorenew e863
av_timer e01b
backspace e14a