0001_initial.py 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # -*- coding: utf-8 -*-
  2. # Generated by Django 1.10.1 on 2016-11-12 17:14
  3. from __future__ import unicode_literals
  4. import autoslug.fields
  5. import chunked_upload.models
  6. from django.conf import settings
  7. from django.db import migrations, models
  8. import django.db.models.deletion
  9. import django.utils.timezone
  10. import mediaconvert.models
  11. import taggit.managers
  12. class Migration(migrations.Migration):
  13. initial = True
  14. dependencies = [
  15. migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  16. ('taggit', '0002_auto_20150616_2121'),
  17. ]
  18. operations = [
  19. migrations.CreateModel(
  20. name='Media',
  21. fields=[
  22. ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  23. ('uri', models.TextField(db_index=True, editable=False, unique=True)),
  24. ('upload', models.FileField(editable=False, upload_to=mediaconvert.models.Media.media_upload_path)),
  25. ('mimetype', models.CharField(max_length=128)),
  26. ('sha512', models.CharField(db_index=True, editable=False, max_length=128)),
  27. ('title', models.CharField(max_length=100)),
  28. ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='title', unique_with=('user',))),
  29. ('description', models.TextField(blank=True)),
  30. ('uploaded', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
  31. ('publish_date', models.DateTimeField(blank=True, null=True)),
  32. ],
  33. ),
  34. migrations.CreateModel(
  35. name='MediaChunkedUpload',
  36. fields=[
  37. ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  38. ('upload_id', models.CharField(default=chunked_upload.models.generate_upload_id, editable=False, max_length=32, unique=True)),
  39. ('file', models.FileField(max_length=255, upload_to=chunked_upload.models.generate_filename)),
  40. ('filename', models.CharField(max_length=255)),
  41. ('offset', models.BigIntegerField(default=0)),
  42. ('created_on', models.DateTimeField(auto_now_add=True)),
  43. ('status', models.PositiveSmallIntegerField(choices=[(1, 'Uploading'), (2, 'Complete')], default=1)),
  44. ('completed_on', models.DateTimeField(blank=True, null=True)),
  45. ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chunked_uploads', to=settings.AUTH_USER_MODEL)),
  46. ],
  47. options={
  48. 'abstract': False,
  49. },
  50. ),
  51. migrations.CreateModel(
  52. name='Thumbnail',
  53. fields=[
  54. ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  55. ('image', models.ImageField(height_field='height', upload_to='', width_field='width')),
  56. ('height', models.PositiveSmallIntegerField()),
  57. ('width', models.PositiveSmallIntegerField()),
  58. ('media', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mediaconvert.Media')),
  59. ],
  60. ),
  61. migrations.AddField(
  62. model_name='media',
  63. name='poster',
  64. field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='poster', to='mediaconvert.Thumbnail'),
  65. ),
  66. migrations.AddField(
  67. model_name='media',
  68. name='tags',
  69. field=taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
  70. ),
  71. migrations.AddField(
  72. model_name='media',
  73. name='user',
  74. field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
  75. ),
  76. ]