diff --git a/django_etesync/migrations/0001_initial.py b/django_etesync/migrations/0001_initial.py index 6fa724b..dc3a2ff 100644 --- a/django_etesync/migrations/0001_initial.py +++ b/django_etesync/migrations/0001_initial.py @@ -1,9 +1,10 @@ -# Generated by Django 3.0.3 on 2020-02-19 15:33 +# Generated by Django 3.0.3 on 2020-05-13 13:01 from django.conf import settings import django.core.validators from django.db import migrations, models import django.db.models.deletion +import django_etesync.models class Migration(migrations.Migration): @@ -19,7 +20,7 @@ class Migration(migrations.Migration): name='Collection', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uid', models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-fA-F0-9\\-_=]{44}')])), + ('uid', models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID', regex='[a-zA-Z0-9]')])), ('version', models.PositiveSmallIntegerField()), ('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], @@ -31,37 +32,60 @@ class Migration(migrations.Migration): name='CollectionItem', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uid', models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-fA-F0-9\\-_=]{44}')])), + ('uid', models.CharField(db_index=True, max_length=44, null=True, validators=[django.core.validators.RegexValidator(message='Not a valid UID', regex='[a-zA-Z0-9]')])), ('version', models.PositiveSmallIntegerField()), - ('encryptionKey', models.BinaryField(editable=True)), - ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_etesync.Collection')), + ('encryptionKey', models.BinaryField(editable=True, null=True)), + ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='django_etesync.Collection')), ], options={ 'unique_together': {('uid', 'collection')}, }, ), migrations.CreateModel( - name='CollectionItemSnapshot', + name='CollectionItemChunk', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uid', models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Expected a 256bit base64url.', regex='^[a-zA-Z0-9\\-_]{43}$')])), + ('chunkFile', models.FileField(max_length=150, unique=True, upload_to=django_etesync.models.chunk_directory_path)), + ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chunks', to='django_etesync.CollectionItem')), + ], + ), + migrations.CreateModel( + name='CollectionItemRevision', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('current', models.BooleanField(default=True)), - ('chunkHmac', models.CharField(max_length=50)), - ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='django_etesync.CollectionItem')), + ('uid', models.CharField(db_index=True, max_length=44, unique=True, validators=[django.core.validators.RegexValidator(message='Expected a 256bit base64url.', regex='^[a-zA-Z0-9\\-_]{43}$')])), + ('meta', models.BinaryField(editable=True)), + ('current', models.BooleanField(db_index=True, default=True, null=True)), + ('deleted', models.BooleanField(default=False)), + ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions', to='django_etesync.CollectionItem')), ], options={ 'unique_together': {('item', 'current')}, }, ), migrations.CreateModel( - name='CollectionItemChunk', + name='RevisionChunkRelation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('uid', models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-fA-F0-9\\-_=]{44}')])), - ('order', models.CharField(max_length=100)), - ('itemSnapshot', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='django_etesync.CollectionItemSnapshot')), + ('chunk', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions_relation', to='django_etesync.CollectionItemChunk')), + ('revision', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chunks_relation', to='django_etesync.CollectionItemRevision')), + ], + options={ + 'ordering': ('id',), + }, + ), + migrations.CreateModel( + name='CollectionMember', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('encryptionKey', models.BinaryField(editable=True)), + ('accessLevel', models.CharField(choices=[('adm', 'Admin'), ('rw', 'Read Write'), ('ro', 'Read Only')], default='ro', max_length=3)), + ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='members', to='django_etesync.Collection')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], options={ - 'ordering': ['order'], + 'unique_together': {('user', 'collection')}, }, ), ] diff --git a/django_etesync/migrations/0002_auto_20200220_0943.py b/django_etesync/migrations/0002_auto_20200220_0943.py deleted file mode 100644 index c150a11..0000000 --- a/django_etesync/migrations/0002_auto_20200220_0943.py +++ /dev/null @@ -1,53 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 09:43 - -import django.core.validators -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0001_initial'), - ] - - operations = [ - migrations.RemoveField( - model_name='collectionitemchunk', - name='itemSnapshot', - ), - migrations.AddField( - model_name='collectionitem', - name='hmac', - field=models.CharField(default='', max_length=50), - preserve_default=False, - ), - migrations.AddField( - model_name='collectionitemchunk', - name='items', - field=models.ManyToManyField(related_name='chunks', to='django_etesync.CollectionItem'), - ), - migrations.AlterField( - model_name='collection', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-zA-Z0-9\\-_=]{44}')]), - ), - migrations.AlterField( - model_name='collectionitem', - name='collection', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='django_etesync.Collection'), - ), - migrations.AlterField( - model_name='collectionitem', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-zA-Z0-9\\-_=]{44}')]), - ), - migrations.AlterField( - model_name='collectionitemchunk', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-zA-Z0-9\\-_=]{44}')]), - ), - migrations.DeleteModel( - name='CollectionItemSnapshot', - ), - ] diff --git a/django_etesync/migrations/0003_collectionitem_current.py b/django_etesync/migrations/0003_collectionitem_current.py deleted file mode 100644 index 2ffbf54..0000000 --- a/django_etesync/migrations/0003_collectionitem_current.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 09:47 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0002_auto_20200220_0943'), - ] - - operations = [ - migrations.AddField( - model_name='collectionitem', - name='current', - field=models.BooleanField(default=True), - ), - ] diff --git a/django_etesync/migrations/0004_auto_20200220_1029.py b/django_etesync/migrations/0004_auto_20200220_1029.py deleted file mode 100644 index 1ea337a..0000000 --- a/django_etesync/migrations/0004_auto_20200220_1029.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 10:29 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0003_collectionitem_current'), - ] - - operations = [ - migrations.AlterField( - model_name='collectionitem', - name='current', - field=models.BooleanField(db_index=True, default=True), - ), - ] diff --git a/django_etesync/migrations/0005_auto_20200220_1123.py b/django_etesync/migrations/0005_auto_20200220_1123.py deleted file mode 100644 index 88c9ea6..0000000 --- a/django_etesync/migrations/0005_auto_20200220_1123.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 11:23 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0004_auto_20200220_1029'), - ] - - operations = [ - migrations.RemoveField( - model_name='collectionitemchunk', - name='items', - ), - migrations.AddField( - model_name='collectionitem', - name='chunks', - field=models.ManyToManyField(related_name='items', to='django_etesync.CollectionItemChunk'), - ), - migrations.AddField( - model_name='collectionitemchunk', - name='collection', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='chunks', to='django_etesync.Collection'), - preserve_default=False, - ), - ] diff --git a/django_etesync/migrations/0006_auto_20200220_1137.py b/django_etesync/migrations/0006_auto_20200220_1137.py deleted file mode 100644 index efc421e..0000000 --- a/django_etesync/migrations/0006_auto_20200220_1137.py +++ /dev/null @@ -1,49 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 11:37 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0005_auto_20200220_1123'), - ] - - operations = [ - migrations.RemoveField( - model_name='collectionitem', - name='chunks', - ), - migrations.RemoveField( - model_name='collectionitem', - name='current', - ), - migrations.RemoveField( - model_name='collectionitem', - name='encryptionKey', - ), - migrations.RemoveField( - model_name='collectionitem', - name='hmac', - ), - migrations.RemoveField( - model_name='collectionitem', - name='version', - ), - migrations.CreateModel( - name='CollectionItemSnapshot', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('version', models.PositiveSmallIntegerField()), - ('encryptionKey', models.BinaryField(editable=True)), - ('hmac', models.CharField(max_length=50)), - ('current', models.BooleanField(db_index=True, default=True)), - ('chunks', models.ManyToManyField(related_name='items', to='django_etesync.CollectionItemChunk')), - ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='snapshots', to='django_etesync.CollectionItem')), - ], - options={ - 'unique_together': {('item', 'current')}, - }, - ), - ] diff --git a/django_etesync/migrations/0007_auto_20200220_1144.py b/django_etesync/migrations/0007_auto_20200220_1144.py deleted file mode 100644 index 3ebf55b..0000000 --- a/django_etesync/migrations/0007_auto_20200220_1144.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 11:44 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0006_auto_20200220_1137'), - ] - - operations = [ - migrations.AddField( - model_name='collectionitemchunk', - name='item', - field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='chunks', to='django_etesync.CollectionItem'), - preserve_default=False, - ), - migrations.AlterUniqueTogether( - name='collectionitemchunk', - unique_together={('item', 'order')}, - ), - migrations.RemoveField( - model_name='collectionitemchunk', - name='collection', - ), - ] diff --git a/django_etesync/migrations/0008_collectionitemchunk_chunkfile.py b/django_etesync/migrations/0008_collectionitemchunk_chunkfile.py deleted file mode 100644 index 68bb27c..0000000 --- a/django_etesync/migrations/0008_collectionitemchunk_chunkfile.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 12:16 - -from django.db import migrations, models -import django_etesync.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0007_auto_20200220_1144'), - ] - - operations = [ - migrations.AddField( - model_name='collectionitemchunk', - name='chunkFile', - field=models.FileField(default='', upload_to=django_etesync.models.chunk_directory_path), - preserve_default=False, - ), - ] diff --git a/django_etesync/migrations/0009_auto_20200220_1220.py b/django_etesync/migrations/0009_auto_20200220_1220.py deleted file mode 100644 index 71e1539..0000000 --- a/django_etesync/migrations/0009_auto_20200220_1220.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 12:20 - -from django.db import migrations, models -import django_etesync.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0008_collectionitemchunk_chunkfile'), - ] - - operations = [ - migrations.AlterField( - model_name='collectionitemchunk', - name='chunkFile', - field=models.FileField(max_length=150, upload_to=django_etesync.models.chunk_directory_path), - ), - ] diff --git a/django_etesync/migrations/0010_auto_20200220_1248.py b/django_etesync/migrations/0010_auto_20200220_1248.py deleted file mode 100644 index 0c08ed0..0000000 --- a/django_etesync/migrations/0010_auto_20200220_1248.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 12:48 - -from django.db import migrations, models -import django_etesync.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0009_auto_20200220_1220'), - ] - - operations = [ - migrations.AlterField( - model_name='collectionitemchunk', - name='chunkFile', - field=models.FileField(max_length=150, unique=True, upload_to=django_etesync.models.chunk_directory_path), - ), - ] diff --git a/django_etesync/migrations/0011_auto_20200220_2037.py b/django_etesync/migrations/0011_auto_20200220_2037.py deleted file mode 100644 index 2d790748..0000000 --- a/django_etesync/migrations/0011_auto_20200220_2037.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 20:37 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0010_auto_20200220_1248'), - ] - - operations = [ - migrations.RenameModel( - old_name='CollectionItemSnapshot', - new_name='CollectionItemRevision', - ), - ] diff --git a/django_etesync/migrations/0012_auto_20200220_2038.py b/django_etesync/migrations/0012_auto_20200220_2038.py deleted file mode 100644 index 2657973..0000000 --- a/django_etesync/migrations/0012_auto_20200220_2038.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-20 20:38 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0011_auto_20200220_2037'), - ] - - operations = [ - migrations.AlterField( - model_name='collectionitemrevision', - name='item', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions', to='django_etesync.CollectionItem'), - ), - ] diff --git a/django_etesync/migrations/0013_collectionitemrevision_is_deletion.py b/django_etesync/migrations/0013_collectionitemrevision_is_deletion.py deleted file mode 100644 index 27f4953..0000000 --- a/django_etesync/migrations/0013_collectionitemrevision_is_deletion.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-26 13:17 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0012_auto_20200220_2038'), - ] - - operations = [ - migrations.AddField( - model_name='collectionitemrevision', - name='is_deletion', - field=models.BooleanField(default=False), - ), - ] diff --git a/django_etesync/migrations/0014_auto_20200226_1322.py b/django_etesync/migrations/0014_auto_20200226_1322.py deleted file mode 100644 index 1937015..0000000 --- a/django_etesync/migrations/0014_auto_20200226_1322.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-26 13:22 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0013_collectionitemrevision_is_deletion'), - ] - - operations = [ - migrations.RenameField( - model_name='collectionitemrevision', - old_name='is_deletion', - new_name='isDeletion', - ), - ] diff --git a/django_etesync/migrations/0015_auto_20200226_1349.py b/django_etesync/migrations/0015_auto_20200226_1349.py deleted file mode 100644 index 896619d..0000000 --- a/django_etesync/migrations/0015_auto_20200226_1349.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-26 13:49 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0014_auto_20200226_1322'), - ] - - operations = [ - migrations.AlterField( - model_name='collectionitemrevision', - name='current', - field=models.BooleanField(blank=True, db_index=True, default=True, null=True), - ), - ] diff --git a/django_etesync/migrations/0016_auto_20200226_1446.py b/django_etesync/migrations/0016_auto_20200226_1446.py deleted file mode 100644 index 2929cbf..0000000 --- a/django_etesync/migrations/0016_auto_20200226_1446.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-26 14:46 - -import django.core.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0015_auto_20200226_1349'), - ] - - operations = [ - migrations.AlterField( - model_name='collection', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-zA-Z0-9\\-_=]{43}')]), - ), - migrations.AlterField( - model_name='collectionitem', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-zA-Z0-9\\-_=]{43}')]), - ), - migrations.AlterField( - model_name='collectionitemchunk', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID. Expected a 256bit base64url.', regex='[a-zA-Z0-9\\-_=]{43}')]), - ), - ] diff --git a/django_etesync/migrations/0017_auto_20200226_1455.py b/django_etesync/migrations/0017_auto_20200226_1455.py deleted file mode 100644 index 2148123..0000000 --- a/django_etesync/migrations/0017_auto_20200226_1455.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-26 14:55 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0016_auto_20200226_1446'), - ] - - operations = [ - migrations.RenameField( - model_name='collectionitemrevision', - old_name='isDeletion', - new_name='deleted', - ), - ] diff --git a/django_etesync/migrations/0018_auto_20200226_1803.py b/django_etesync/migrations/0018_auto_20200226_1803.py deleted file mode 100644 index ae9200d..0000000 --- a/django_etesync/migrations/0018_auto_20200226_1803.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-26 18:03 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0017_auto_20200226_1455'), - ] - - operations = [ - migrations.AlterField( - model_name='collectionitemrevision', - name='current', - field=models.BooleanField(db_index=True, default=True, null=True), - ), - ] diff --git a/django_etesync/migrations/0019_collectionmember.py b/django_etesync/migrations/0019_collectionmember.py deleted file mode 100644 index 142e945..0000000 --- a/django_etesync/migrations/0019_collectionmember.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-26 18:33 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('django_etesync', '0018_auto_20200226_1803'), - ] - - operations = [ - migrations.CreateModel( - name='CollectionMember', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('encryptionKey', models.BinaryField(editable=True)), - ('accessLevel', models.CharField(choices=[('adm', 'Admin'), ('rw', 'Read Write'), ('ro', 'Read Only')], default='ro', max_length=3)), - ('collection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='members', to='django_etesync.Collection')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - options={ - 'unique_together': {('user', 'collection')}, - }, - ), - ] diff --git a/django_etesync/migrations/0020_auto_20200310_1438.py b/django_etesync/migrations/0020_auto_20200310_1438.py deleted file mode 100644 index 6949145..0000000 --- a/django_etesync/migrations/0020_auto_20200310_1438.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-10 14:38 - -import django.core.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0019_collectionmember'), - ] - - operations = [ - migrations.AlterField( - model_name='collection', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID', regex='[a-zA-Z0-9]{24}')]), - ), - migrations.AlterField( - model_name='collectionitem', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID', regex='[a-zA-Z0-9]{24}')]), - ), - migrations.AlterField( - model_name='collectionitemchunk', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Expected a 256bit base64url.', regex='^[a-zA-Z0-9\\-_]{43}=?$')]), - ), - ] diff --git a/django_etesync/migrations/0021_auto_20200310_1439.py b/django_etesync/migrations/0021_auto_20200310_1439.py deleted file mode 100644 index 3f1341e..0000000 --- a/django_etesync/migrations/0021_auto_20200310_1439.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-10 14:39 - -import django.core.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0020_auto_20200310_1438'), - ] - - operations = [ - migrations.AlterField( - model_name='collection', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID', regex='[a-zA-Z0-9]')]), - ), - migrations.AlterField( - model_name='collectionitem', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID', regex='[a-zA-Z0-9]')]), - ), - ] diff --git a/django_etesync/migrations/0022_auto_20200310_1547.py b/django_etesync/migrations/0022_auto_20200310_1547.py deleted file mode 100644 index cbd0ee7..0000000 --- a/django_etesync/migrations/0022_auto_20200310_1547.py +++ /dev/null @@ -1,33 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-10 15:47 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0021_auto_20200310_1439'), - ] - - operations = [ - migrations.RemoveField( - model_name='collectionitemrevision', - name='encryptionKey', - ), - migrations.RemoveField( - model_name='collectionitemrevision', - name='version', - ), - migrations.AddField( - model_name='collectionitem', - name='encryptionKey', - field=models.BinaryField(default=b'aoesnutheounth', editable=True), - preserve_default=False, - ), - migrations.AddField( - model_name='collectionitem', - name='version', - field=models.PositiveSmallIntegerField(default=1), - preserve_default=False, - ), - ] diff --git a/django_etesync/migrations/0023_auto_20200310_1556.py b/django_etesync/migrations/0023_auto_20200310_1556.py deleted file mode 100644 index e2a9b80..0000000 --- a/django_etesync/migrations/0023_auto_20200310_1556.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-10 15:56 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0022_auto_20200310_1547'), - ] - - operations = [ - migrations.AlterModelOptions( - name='collectionitemchunk', - options={'ordering': ('item', 'order')}, - ), - ] diff --git a/django_etesync/migrations/0024_collectionitemrevision_uid.py b/django_etesync/migrations/0024_collectionitemrevision_uid.py deleted file mode 100644 index 6134c89..0000000 --- a/django_etesync/migrations/0024_collectionitemrevision_uid.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-12 13:41 - -import django.core.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0023_auto_20200310_1556'), - ] - - operations = [ - migrations.AddField( - model_name='collectionitemrevision', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Not a valid UID', regex='[a-zA-Z0-9]')]), - ), - ] diff --git a/django_etesync/migrations/0025_auto_20200312_1350.py b/django_etesync/migrations/0025_auto_20200312_1350.py deleted file mode 100644 index b54aeff..0000000 --- a/django_etesync/migrations/0025_auto_20200312_1350.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-12 13:50 - -import django.core.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0024_collectionitemrevision_uid'), - ] - - operations = [ - migrations.AlterField( - model_name='collectionitemrevision', - name='uid', - field=models.CharField(db_index=True, max_length=44, unique=True, validators=[django.core.validators.RegexValidator(message='Not a valid UID', regex='[a-zA-Z0-9]')]), - ), - ] diff --git a/django_etesync/migrations/0026_collectionitemrevision_meta.py b/django_etesync/migrations/0026_collectionitemrevision_meta.py deleted file mode 100644 index 8056e61..0000000 --- a/django_etesync/migrations/0026_collectionitemrevision_meta.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-12 14:01 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0025_auto_20200312_1350'), - ] - - operations = [ - migrations.AddField( - model_name='collectionitemrevision', - name='meta', - field=models.BinaryField(blank=True, editable=True, null=True), - ), - ] diff --git a/django_etesync/migrations/0027_collection_mainitem.py b/django_etesync/migrations/0027_collection_mainitem.py deleted file mode 100644 index b420d8f..0000000 --- a/django_etesync/migrations/0027_collection_mainitem.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-12 14:14 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0026_collectionitemrevision_meta'), - ] - - operations = [ - migrations.AddField( - model_name='collection', - name='mainItem', - field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='of_collection', to='django_etesync.CollectionItem'), - ), - ] diff --git a/django_etesync/migrations/0028_auto_20200312_1819.py b/django_etesync/migrations/0028_auto_20200312_1819.py deleted file mode 100644 index 6d76499..0000000 --- a/django_etesync/migrations/0028_auto_20200312_1819.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-12 18:19 - -import django.core.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0027_collection_mainitem'), - ] - - operations = [ - migrations.AlterField( - model_name='collectionitem', - name='encryptionKey', - field=models.BinaryField(editable=True, null=True), - ), - migrations.AlterField( - model_name='collectionitem', - name='uid', - field=models.CharField(db_index=True, max_length=44, null=True, validators=[django.core.validators.RegexValidator(message='Not a valid UID', regex='[a-zA-Z0-9]')]), - ), - ] diff --git a/django_etesync/migrations/0029_auto_20200312_1849.py b/django_etesync/migrations/0029_auto_20200312_1849.py deleted file mode 100644 index 568aaa2..0000000 --- a/django_etesync/migrations/0029_auto_20200312_1849.py +++ /dev/null @@ -1,35 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-12 18:49 - -from django.db import migrations -from django.utils.crypto import get_random_string - - -def generate_rev_uid(length=32): - return get_random_string(length) - - -def add_collection_main_item(apps, schema_editor): - Collection = apps.get_model('django_etesync', 'Collection') - CollectionItem = apps.get_model('django_etesync', 'CollectionItem') - CollectionItemRevision = apps.get_model('django_etesync', 'CollectionItemRevision') - - for col in Collection.objects.all(): - main_item = CollectionItem.objects.create(uid=None, encryptionKey=None, version=col.version, collection=col) - col.mainItem = main_item - col.save() - - CollectionItemRevision.objects.create( - uid=generate_rev_uid(), - hmac='hmac-hash', - item=main_item) - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0028_auto_20200312_1819'), - ] - - operations = [ - migrations.RunPython(add_collection_main_item), - ] diff --git a/django_etesync/migrations/0030_auto_20200312_1859.py b/django_etesync/migrations/0030_auto_20200312_1859.py deleted file mode 100644 index fe8050a..0000000 --- a/django_etesync/migrations/0030_auto_20200312_1859.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-12 18:59 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0029_auto_20200312_1849'), - ] - - operations = [ - migrations.AlterField( - model_name='collection', - name='mainItem', - field=models.OneToOneField(on_delete=django.db.models.deletion.PROTECT, related_name='of_collection', to='django_etesync.CollectionItem'), - ), - ] diff --git a/django_etesync/migrations/0031_auto_20200317_1509.py b/django_etesync/migrations/0031_auto_20200317_1509.py deleted file mode 100644 index 7166781..0000000 --- a/django_etesync/migrations/0031_auto_20200317_1509.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-17 15:09 - -import django.core.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0030_auto_20200312_1859'), - ] - - operations = [ - migrations.AlterField( - model_name='collectionitemchunk', - name='uid', - field=models.CharField(db_index=True, max_length=44, validators=[django.core.validators.RegexValidator(message='Expected a 256bit base64url.', regex='^[a-zA-Z0-9\\-_]{43}$')]), - ), - ] diff --git a/django_etesync/migrations/0032_auto_20200317_1513.py b/django_etesync/migrations/0032_auto_20200317_1513.py deleted file mode 100644 index 0546711..0000000 --- a/django_etesync/migrations/0032_auto_20200317_1513.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-17 15:13 - -import django.core.validators -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0031_auto_20200317_1509'), - ] - - operations = [ - migrations.RemoveField( - model_name='collectionitemrevision', - name='hmac', - ), - migrations.AlterField( - model_name='collectionitemrevision', - name='uid', - field=models.CharField(db_index=True, max_length=44, unique=True, validators=[django.core.validators.RegexValidator(message='Expected a 256bit base64url.', regex='^[a-zA-Z0-9\\-_]{43}$')]), - ), - ] diff --git a/django_etesync/migrations/0033_auto_20200317_2010.py b/django_etesync/migrations/0033_auto_20200317_2010.py deleted file mode 100644 index 7a42b38..0000000 --- a/django_etesync/migrations/0033_auto_20200317_2010.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-17 20:10 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0032_auto_20200317_1513'), - ] - - operations = [ - migrations.AlterField( - model_name='collectionitemrevision', - name='meta', - field=models.BinaryField(default=b'', editable=True), - preserve_default=False, - ), - ] diff --git a/django_etesync/migrations/0034_auto_20200415_1248.py b/django_etesync/migrations/0034_auto_20200415_1248.py deleted file mode 100644 index 1156676..0000000 --- a/django_etesync/migrations/0034_auto_20200415_1248.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-04-15 12:48 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0033_auto_20200317_2010'), - ] - - operations = [ - migrations.AlterField( - model_name='collection', - name='mainItem', - field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='of_collection', to='django_etesync.CollectionItem'), - ), - ] diff --git a/django_etesync/migrations/0035_auto_20200415_1259.py b/django_etesync/migrations/0035_auto_20200415_1259.py deleted file mode 100644 index d558e31..0000000 --- a/django_etesync/migrations/0035_auto_20200415_1259.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.3 on 2020-04-15 12:59 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0034_auto_20200415_1248'), - ] - - operations = [ - migrations.AlterField( - model_name='collection', - name='mainItem', - field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='of_collection', to='django_etesync.CollectionItem'), - ), - ] diff --git a/django_etesync/migrations/0036_auto_20200415_1420.py b/django_etesync/migrations/0036_auto_20200415_1420.py deleted file mode 100644 index a7b8003..0000000 --- a/django_etesync/migrations/0036_auto_20200415_1420.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 3.0.3 on 2020-04-15 14:20 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0035_auto_20200415_1259'), - ] - - operations = [ - migrations.AlterModelOptions( - name='collectionitemchunk', - options={}, - ), - migrations.AlterUniqueTogether( - name='collectionitemchunk', - unique_together=set(), - ), - migrations.CreateModel( - name='RevisionChunkRelation', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('chunk', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions_relation', to='django_etesync.CollectionItemChunk')), - ('revision', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chunks_relation', to='django_etesync.CollectionItemRevision')), - ], - options={ - 'ordering': ('id',), - }, - ), - migrations.RemoveField( - model_name='collectionitemchunk', - name='order', - ), - ] diff --git a/django_etesync/migrations/0037_auto_20200415_1421.py b/django_etesync/migrations/0037_auto_20200415_1421.py deleted file mode 100644 index d1a47db..0000000 --- a/django_etesync/migrations/0037_auto_20200415_1421.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.0.3 on 2020-04-15 14:21 - -from django.db import migrations - - -def change_chunk_relation(apps, schema_editor): - CollectionItemRevision = apps.get_model('django_etesync', 'CollectionItemRevision') - RevisionChunkRelation = apps.get_model('django_etesync', 'RevisionChunkRelation') - - for revision in CollectionItemRevision.objects.all(): - for chunk in revision.chunks.all(): - RevisionChunkRelation.objects.create(chunk=chunk, revision=revision) - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0036_auto_20200415_1420'), - ] - - operations = [ - migrations.RunPython(change_chunk_relation), - ] diff --git a/django_etesync/migrations/0038_remove_collectionitemrevision_chunks.py b/django_etesync/migrations/0038_remove_collectionitemrevision_chunks.py deleted file mode 100644 index 6e35b86..0000000 --- a/django_etesync/migrations/0038_remove_collectionitemrevision_chunks.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.0.3 on 2020-04-15 14:34 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0037_auto_20200415_1421'), - ] - - operations = [ - migrations.RemoveField( - model_name='collectionitemrevision', - name='chunks', - ), - ] diff --git a/django_etesync/migrations/0039_remove_collection_mainitem.py b/django_etesync/migrations/0039_remove_collection_mainitem.py deleted file mode 100644 index 1822bc7..0000000 --- a/django_etesync/migrations/0039_remove_collection_mainitem.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.0.3 on 2020-04-16 08:28 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('django_etesync', '0038_remove_collectionitemrevision_chunks'), - ] - - operations = [ - migrations.RemoveField( - model_name='collection', - name='mainItem', - ), - ] diff --git a/myauth/__init__.py b/myauth/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/myauth/admin.py b/myauth/admin.py new file mode 100644 index 0000000..f91be8f --- /dev/null +++ b/myauth/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin +from django.contrib.auth.admin import UserAdmin +from .models import User + +admin.site.register(User, UserAdmin) diff --git a/myauth/apps.py b/myauth/apps.py new file mode 100644 index 0000000..611e83d --- /dev/null +++ b/myauth/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class MyauthConfig(AppConfig): + name = 'myauth' diff --git a/myauth/migrations/0001_initial.py b/myauth/migrations/0001_initial.py new file mode 100644 index 0000000..1f81e95 --- /dev/null +++ b/myauth/migrations/0001_initial.py @@ -0,0 +1,44 @@ +# Generated by Django 3.0.3 on 2020-05-13 13:00 + +import django.contrib.auth.models +import django.contrib.auth.validators +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('auth', '0011_update_proxy_permissions'), + ] + + operations = [ + migrations.CreateModel( + name='User', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), + ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), + ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')), + ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), + ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), + ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), + ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), + ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), + ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), + ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), + ], + options={ + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + 'abstract': False, + }, + managers=[ + ('objects', django.contrib.auth.models.UserManager()), + ], + ), + ] diff --git a/myauth/migrations/__init__.py b/myauth/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/myauth/models.py b/myauth/models.py new file mode 100644 index 0000000..3d30525 --- /dev/null +++ b/myauth/models.py @@ -0,0 +1,5 @@ +from django.contrib.auth.models import AbstractUser + + +class User(AbstractUser): + pass diff --git a/myauth/tests.py b/myauth/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/myauth/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/myauth/views.py b/myauth/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/myauth/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.