Gitlab CSE Unil

0001_initial.py 8.69 KB
Newer Older
Julien Furrer's avatar
Julien Furrer committed
1
# -*- coding: utf-8 -*-
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
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,
        ),
    ]