Skip to content
This repository
Browse code

Merge branch 'dev' into x-third-party-auth

  • Loading branch information...
commit d04d12b4097009decc853f0d71afd560e795d8cc 2 parents bc24cd3 + cfbfcb3
Steve Losh authored
303  apps/teams/migrations/0097_add_index_on_tasks_for_team_and_expiration.py
... ...
@@ -0,0 +1,303 @@
  1
+# encoding: utf-8
  2
+import datetime
  3
+from south.db import db
  4
+from south.v2 import DataMigration
  5
+from django.db import models
  6
+
  7
+class Migration(DataMigration):
  8
+
  9
+    def forwards(self, orm):
  10
+        db.create_index('teams_task', ['team_id', 'expiration_date'])
  11
+
  12
+    def backwards(self, orm):
  13
+        db.delete_index('teams_task', ['team_id', 'expiration_date'])
  14
+
  15
+
  16
+    models = {
  17
+        'accountlinker.thirdpartyaccount': {
  18
+            'Meta': {'unique_together': "(('type', 'username'),)", 'object_name': 'ThirdPartyAccount'},
  19
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  20
+            'oauth_access_token': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
  21
+            'oauth_refresh_token': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
  22
+            'type': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
  23
+            'username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
  24
+        },
  25
+        'auth.customuser': {
  26
+            'Meta': {'object_name': 'CustomUser', '_ormbases': ['auth.User']},
  27
+            'autoplay_preferences': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
  28
+            'award_points': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
  29
+            'biography': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
  30
+            'full_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '63', 'blank': 'True'}),
  31
+            'homepage': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
  32
+            'is_partner': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  33
+            'last_ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
  34
+            'notify_by_email': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
  35
+            'notify_by_message': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
  36
+            'partner': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '32', 'null': 'True', 'blank': 'True'}),
  37
+            'picture': ('utils.amazon.fields.S3EnabledImageField', [], {'thumb_options': "{'upscale': True, 'crop': 'smart'}", 'max_length': '100', 'blank': 'True'}),
  38
+            'preferred_language': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
  39
+            'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}),
  40
+            'valid_email': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  41
+            'videos': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['videos.Video']", 'symmetrical': 'False', 'blank': 'True'})
  42
+        },
  43
+        'auth.group': {
  44
+            'Meta': {'object_name': 'Group'},
  45
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  46
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
  47
+            'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
  48
+        },
  49
+        'auth.permission': {
  50
+            'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
  51
+            'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  52
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
  53
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  54
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
  55
+        },
  56
+        'auth.user': {
  57
+            'Meta': {'object_name': 'User'},
  58
+            'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  59
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
  60
+            'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
  61
+            'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
  62
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  63
+            'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
  64
+            'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  65
+            'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  66
+            'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  67
+            'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
  68
+            'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
  69
+            'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
  70
+            'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
  71
+        },
  72
+        'contenttypes.contenttype': {
  73
+            'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
  74
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  75
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  76
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  77
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
  78
+        },
  79
+        'teams.application': {
  80
+            'Meta': {'unique_together': "(('team', 'user'),)", 'object_name': 'Application'},
  81
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  82
+            'note': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
  83
+            'team': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'applications'", 'to': "orm['teams.Team']"}),
  84
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'team_applications'", 'to': "orm['auth.CustomUser']"})
  85
+        },
  86
+        'teams.invite': {
  87
+            'Meta': {'unique_together': "(('team', 'user'),)", 'object_name': 'Invite'},
  88
+            'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']"}),
  89
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  90
+            'note': ('django.db.models.fields.TextField', [], {'max_length': '200', 'blank': 'True'}),
  91
+            'role': ('django.db.models.fields.CharField', [], {'default': "'contributor'", 'max_length': '16'}),
  92
+            'team': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'invitations'", 'to': "orm['teams.Team']"}),
  93
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'team_invitations'", 'to': "orm['auth.CustomUser']"})
  94
+        },
  95
+        'teams.membershipnarrowing': {
  96
+            'Meta': {'object_name': 'MembershipNarrowing'},
  97
+            'added_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'narrowing_includer'", 'null': 'True', 'to': "orm['teams.TeamMember']"}),
  98
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  99
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  100
+            'language': ('django.db.models.fields.CharField', [], {'max_length': '24', 'blank': 'True'}),
  101
+            'member': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'narrowings'", 'to': "orm['teams.TeamMember']"}),
  102
+            'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
  103
+            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Project']", 'null': 'True', 'blank': 'True'})
  104
+        },
  105
+        'teams.project': {
  106
+            'Meta': {'unique_together': "(('team', 'name'), ('team', 'slug'))", 'object_name': 'Project'},
  107
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  108
+            'description': ('django.db.models.fields.TextField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}),
  109
+            'guidelines': ('django.db.models.fields.TextField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}),
  110
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  111
+            'modified': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}),
  112
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
  113
+            'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
  114
+            'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '50', 'blank': 'True'}),
  115
+            'team': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Team']"}),
  116
+            'workflow_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'})
  117
+        },
  118
+        'teams.setting': {
  119
+            'Meta': {'unique_together': "(('key', 'team'),)", 'object_name': 'Setting'},
  120
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  121
+            'data': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
  122
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  123
+            'key': ('django.db.models.fields.PositiveIntegerField', [], {}),
  124
+            'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
  125
+            'team': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'settings'", 'to': "orm['teams.Team']"})
  126
+        },
  127
+        'teams.task': {
  128
+            'Meta': {'object_name': 'Task'},
  129
+            'approved': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
  130
+            'assignee': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']", 'null': 'True', 'blank': 'True'}),
  131
+            'body': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
  132
+            'completed': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
  133
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  134
+            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  135
+            'expiration_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
  136
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  137
+            'language': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '16', 'blank': 'True'}),
  138
+            'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
  139
+            'priority': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True', 'blank': 'True'}),
  140
+            'public': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  141
+            'review_base_version': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'tasks_based_on'", 'null': 'True', 'to': "orm['videos.SubtitleVersion']"}),
  142
+            'subtitle_version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.SubtitleVersion']", 'null': 'True', 'blank': 'True'}),
  143
+            'team': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Team']"}),
  144
+            'team_video': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.TeamVideo']"}),
  145
+            'type': ('django.db.models.fields.PositiveIntegerField', [], {})
  146
+        },
  147
+        'teams.team': {
  148
+            'Meta': {'object_name': 'Team'},
  149
+            'applicants': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'applicated_teams'", 'symmetrical': 'False', 'through': "orm['teams.Application']", 'to': "orm['auth.CustomUser']"}),
  150
+            'application_text': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
  151
+            'auth_provider_code': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '24', 'blank': 'True'}),
  152
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  153
+            'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  154
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
  155
+            'header_html_text': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
  156
+            'highlight': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  157
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  158
+            'is_moderated': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  159
+            'is_visible': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
  160
+            'last_notification_time': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
  161
+            'logo': ('utils.amazon.fields.S3EnabledImageField', [], {'thumb_options': "{'upscale': True, 'autocrop': True}", 'max_length': '100', 'blank': 'True'}),
  162
+            'max_tasks_per_member': ('django.db.models.fields.PositiveIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
  163
+            'membership_policy': ('django.db.models.fields.IntegerField', [], {'default': '4'}),
  164
+            'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '250'}),
  165
+            'page_content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
  166
+            'points': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
  167
+            'projects_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  168
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),
  169
+            'subtitle_policy': ('django.db.models.fields.IntegerField', [], {'default': '10'}),
  170
+            'task_assign_policy': ('django.db.models.fields.IntegerField', [], {'default': '10'}),
  171
+            'task_expiration': ('django.db.models.fields.PositiveIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
  172
+            'third_party_accounts': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'tseams'", 'symmetrical': 'False', 'to': "orm['accountlinker.ThirdPartyAccount']"}),
  173
+            'translate_policy': ('django.db.models.fields.IntegerField', [], {'default': '10'}),
  174
+            'users': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'teams'", 'symmetrical': 'False', 'through': "orm['teams.TeamMember']", 'to': "orm['auth.CustomUser']"}),
  175
+            'video': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'intro_for_teams'", 'null': 'True', 'to': "orm['videos.Video']"}),
  176
+            'video_policy': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
  177
+            'videos': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['videos.Video']", 'through': "orm['teams.TeamVideo']", 'symmetrical': 'False'}),
  178
+            'workflow_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'})
  179
+        },
  180
+        'teams.teamlanguagepreference': {
  181
+            'Meta': {'unique_together': "(('team', 'language_code'),)", 'object_name': 'TeamLanguagePreference'},
  182
+            'allow_reads': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  183
+            'allow_writes': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  184
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  185
+            'language_code': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
  186
+            'preferred': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  187
+            'team': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'lang_preferences'", 'to': "orm['teams.Team']"})
  188
+        },
  189
+        'teams.teammember': {
  190
+            'Meta': {'unique_together': "(('team', 'user'),)", 'object_name': 'TeamMember'},
  191
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  192
+            'role': ('django.db.models.fields.CharField', [], {'default': "'contributor'", 'max_length': '16', 'db_index': 'True'}),
  193
+            'team': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'members'", 'to': "orm['teams.Team']"}),
  194
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'team_members'", 'to': "orm['auth.CustomUser']"})
  195
+        },
  196
+        'teams.teamnotificationsetting': {
  197
+            'Meta': {'object_name': 'TeamNotificationSetting'},
  198
+            'basic_auth_password': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
  199
+            'basic_auth_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
  200
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
  201
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  202
+            'notification_class': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
  203
+            'request_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
  204
+            'team': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'notification_settings'", 'unique': 'True', 'to': "orm['teams.Team']"})
  205
+        },
  206
+        'teams.teamvideo': {
  207
+            'Meta': {'unique_together': "(('team', 'video'),)", 'object_name': 'TeamVideo'},
  208
+            'added_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']"}),
  209
+            'all_languages': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  210
+            'completed_languages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['videos.SubtitleLanguage']", 'symmetrical': 'False', 'blank': 'True'}),
  211
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  212
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
  213
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  214
+            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Project']"}),
  215
+            'team': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Team']"}),
  216
+            'thumbnail': ('utils.amazon.fields.S3EnabledImageField', [], {'max_length': '100', 'thumb_options': "{'upscale': True, 'crop': 'smart'}", 'null': 'True', 'thumb_sizes': '((290, 165), (120, 90))', 'blank': 'True'}),
  217
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}),
  218
+            'video': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['videos.Video']", 'unique': 'True'})
  219
+        },
  220
+        'teams.workflow': {
  221
+            'Meta': {'unique_together': "(('team', 'project', 'team_video'),)", 'object_name': 'Workflow'},
  222
+            'approve_allowed': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
  223
+            'autocreate_subtitle': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  224
+            'autocreate_translate': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  225
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  226
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  227
+            'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
  228
+            'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Project']", 'null': 'True', 'blank': 'True'}),
  229
+            'review_allowed': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
  230
+            'team': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Team']"}),
  231
+            'team_video': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.TeamVideo']", 'null': 'True', 'blank': 'True'})
  232
+        },
  233
+        'videos.subtitlelanguage': {
  234
+            'Meta': {'unique_together': "(('video', 'language', 'standard_language'),)", 'object_name': 'SubtitleLanguage'},
  235
+            'created': ('django.db.models.fields.DateTimeField', [], {}),
  236
+            'followers': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'followed_languages'", 'blank': 'True', 'to': "orm['auth.CustomUser']"}),
  237
+            'had_version': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  238
+            'has_version': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
  239
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  240
+            'is_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  241
+            'is_forked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  242
+            'is_original': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  243
+            'language': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
  244
+            'percent_done': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
  245
+            'standard_language': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.SubtitleLanguage']", 'null': 'True', 'blank': 'True'}),
  246
+            'subtitle_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
  247
+            'subtitles_fetched_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
  248
+            'video': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.Video']"}),
  249
+            'writelock_owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']", 'null': 'True', 'blank': 'True'}),
  250
+            'writelock_session_key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
  251
+            'writelock_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'})
  252
+        },
  253
+        'videos.subtitleversion': {
  254
+            'Meta': {'unique_together': "(('language', 'version_no'),)", 'object_name': 'SubtitleVersion'},
  255
+            'datetime_started': ('django.db.models.fields.DateTimeField', [], {}),
  256
+            'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
  257
+            'forked_from': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.SubtitleVersion']", 'null': 'True', 'blank': 'True'}),
  258
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  259
+            'is_forked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  260
+            'language': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.SubtitleLanguage']"}),
  261
+            'moderation_status': ('django.db.models.fields.CharField', [], {'default': "'not__under_moderation'", 'max_length': '32', 'db_index': 'True'}),
  262
+            'note': ('django.db.models.fields.CharField', [], {'max_length': '512', 'blank': 'True'}),
  263
+            'notification_sent': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  264
+            'result_of_rollback': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  265
+            'text_change': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
  266
+            'time_change': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
  267
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}),
  268
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']"}),
  269
+            'version_no': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
  270
+        },
  271
+        'videos.video': {
  272
+            'Meta': {'object_name': 'Video'},
  273
+            'allow_community_edits': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  274
+            'allow_video_urls_edit': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
  275
+            'complete_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
  276
+            'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
  277
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
  278
+            'duration': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
  279
+            'edited': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
  280
+            'featured': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
  281
+            'followers': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'followed_videos'", 'blank': 'True', 'to': "orm['auth.CustomUser']"}),
  282
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  283
+            'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
  284
+            'is_subtitled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
  285
+            'languages_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
  286
+            'moderated_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'moderating'", 'null': 'True', 'to': "orm['teams.Team']"}),
  287
+            's3_thumbnail': ('utils.amazon.fields.S3EnabledImageField', [], {'thumb_options': "{'upscale': True, 'crop': 'smart'}", 'max_length': '100', 'thumb_sizes': '((290, 165), (120, 90))', 'blank': 'True'}),
  288
+            'small_thumbnail': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}),
  289
+            'subtitles_fetched_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}),
  290
+            'thumbnail': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}),
  291
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}),
  292
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']", 'null': 'True', 'blank': 'True'}),
  293
+            'video_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
  294
+            'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
  295
+            'was_subtitled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
  296
+            'widget_views_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}),
  297
+            'writelock_owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'writelock_owners'", 'null': 'True', 'to': "orm['auth.CustomUser']"}),
  298
+            'writelock_session_key': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
  299
+            'writelock_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'})
  300
+        }
  301
+    }
  302
+
  303
+    complete_apps = ['teams']
19  apps/videos/forms.py
@@ -479,25 +479,6 @@ def save(self):
479 479
 
480 480
         return sl
481 481
 
482  
-class PasteTranscriptionForm(SubtitlesUploadBaseForm):
483  
-    subtitles = forms.CharField()
484  
-
485  
-    def save(self):
486  
-        subtitles = self.cleaned_data['subtitles']
487  
-        parser = TxtSubtitleParser(subtitles)
488  
-        language = self.save_subtitles(parser, update_video=False, is_complete=False)
489  
-
490  
-        self.verify_tasks(is_complete=False)
491  
-
492  
-        latest_version = language.latest_version()
493  
-
494  
-        if latest_version:
495  
-            video_changed_tasks.delay(language.video_id, language.latest_version().id)
496  
-        else:
497  
-            video_changed_tasks.delay(language.video_id)
498  
-
499  
-        return language
500  
-
501 482
 class UserTestResultForm(forms.ModelForm):
502 483
 
503 484
     class Meta:
18  apps/videos/templatetags/subtitles_tags.py
@@ -20,7 +20,7 @@
20 20
 from django.utils.translation import ugettext_lazy as _, ungettext
21 21
 from django.utils import translation
22 22
 
23  
-from videos.forms import SubtitlesUploadForm, PasteTranscriptionForm, CreateVideoUrlForm
  23
+from videos.forms import SubtitlesUploadForm, CreateVideoUrlForm
24 24
 from icanhaz.models import VideoVisibilityPolicy
25 25
 
26 26
 register = template.Library()
@@ -41,22 +41,6 @@ def upload_subtitles(context, video):
41 41
     context['form'] = SubtitlesUploadForm(context['user'], initial=initial)
42 42
     return context
43 43
 
44  
-@register.inclusion_tag('videos/_paste_transcription.html', takes_context=True)
45  
-def paste_transcription(context):
46  
-    #It is just template of pop-up, you should add link with 'upload-transcript-button' class
47  
-    initial = {}
48  
-    if context.get('language') and context['language'].language:
49  
-        initial['language'] = context['language'].language
50  
-    else:
51  
-        initial['language'] = translation.get_language()
52  
-
53  
-    original_language = context['video'].subtitle_language()
54  
-    if original_language and original_language.language:
55  
-        initial['video_language'] = original_language.language
56  
-
57  
-    context['form'] = PasteTranscriptionForm(context['user'], initial=initial)
58  
-    return context
59  
-
60 44
 @register.simple_tag
61 45
 def complete_indicator(language, mode='normal'):
62 46
     if language.is_original or language.is_forked:
4  apps/videos/templatetags/videos_tags.py
@@ -97,6 +97,10 @@ def video_url(parser, token, node_cls=VideoURLNode):
97 97
         asvar=node_instance.asvar)
98 98
 video_url = register.tag(video_url)
99 99
 
  100
+@register.filter
  101
+def in_progress(language):
  102
+    return language.latest_version(False)
  103
+
100 104
 
101 105
 @register.inclusion_tag("videos/_visibility_control_button.html")
102 106
 def render_visibility_button(video, user):
46  apps/videos/tests.py
@@ -920,7 +920,6 @@ def test_access_video_page_no_original(self):
920 920
         # with blank language codes.
921 921
         self.assertEqual(response.status_code, 302)
922 922
 
923  
-
924 923
     def test_bliptv_twice(self):
925 924
         VIDEO_FILE = 'http://blip.tv/file/get/Kipkay-AirDusterOfficeWeaponry223.m4v'
926 925
         old_video_file_url = blip.video_file_url
@@ -942,49 +941,6 @@ def test_subscribe_to_updates(self):
942 941
         # TODO: write test
943 942
         pass
944 943
 
945  
-    def test_paste_transcription(self):
946  
-        user1 = User.objects.get(username='admin1')
947  
-        self.client.login(username='admin1', password='admin')
948  
-
949  
-        self.assertFalse(self.video.followers.filter(pk=user1.pk).exists())
950  
-
951  
-        mail.outbox = []
952  
-
953  
-        language_code = u"el"
954  
-
955  
-        data = {
956  
-            "video": u"1",
957  
-            "subtitles": u"""#1
958  
-
959  
-#2""",
960  
-            "language": language_code,
961  
-            "video_language": u"en"
962  
-        }
963  
-        language = self.video.subtitle_language(language_code)
964  
-        self.assertEquals(language, None)
965  
-        response = self.client.post(reverse("videos:paste_transcription"), data)
966  
-        self.failUnlessEqual(response.status_code, 200)
967  
-
968  
-        language = self.video.subtitle_language(language_code)
969  
-        version = language.latest_version(public_only=False)
970  
-        self.assertEqual(len(version.subtitles()), 2)
971  
-
972  
-    def test_paste_transcription_windows(self):
973  
-        self._login()
974  
-
975  
-        language_code = u"el"
976  
-
977  
-        data = {
978  
-            "video": u"1",
979  
-            "subtitles": u"#1\r\n\r\n#2",
980  
-            "language": language_code,
981  
-            "video_language": u"en"
982  
-        }
983  
-        self.client.post(reverse("videos:paste_transcription"), data)
984  
-        language = self.video.subtitle_language(language_code)
985  
-        version = language.latest_version(public_only=True)
986  
-        self.assertEqual(len(version.subtitles()), 2)
987  
-
988 944
     def test_email_friend(self):
989 945
         self._simple_test('videos:email_friend')
990 946
 
@@ -1087,7 +1043,6 @@ def test_rollback_updates_sub_count(self):
1087 1043
         final_num_subs = len(last_v.subtitles())
1088 1044
         self.assertEqual(final_num_subs, num_subs)
1089 1045
 
1090  
-
1091 1046
     def test_diffing(self):
1092 1047
         version = self.video.version(version_no=0)
1093 1048
         last_version = self.video.version()
@@ -1111,7 +1066,6 @@ def test_test_form_page(self):
1111 1066
         except UserTestResult.DoesNotExist:
1112 1067
             self.fail()
1113 1068
 
1114  
-
1115 1069
     def test_search(self):
1116 1070
         self._simple_test('search:index')
1117 1071
 
1  apps/videos/urls.py
@@ -36,7 +36,6 @@
36 36
     url(r'^feedback/$', 'feedback', name='feedback'),
37 37
     url(r'^feedback/error/$', 'feedback', {'hide_captcha': True}, 'feedback_error'),
38 38
     url(r'^upload_subtitles/$', 'upload_subtitles', name='upload_subtitles'),
39  
-    url(r'^paste_transcription/$', 'paste_transcription', name='paste_transcription'),
40 39
     url(r'^upload_transcription_file/$', 'upload_transcription_file', name='upload_transcription_file'),
41 40
     url(r'^create/$', 'create', name='create'),
42 41
     url(r'^create/feed/$', 'create_from_feed', name='create_from_feed'),
14  apps/videos/views.py
@@ -24,7 +24,7 @@
24 24
 from videos.models import Video, Action, SubtitleLanguage, SubtitleVersion,  \
25 25
     VideoUrl, AlreadyEditingException, restrict_versions
26 26
 from videos.forms import VideoForm, FeedbackForm, EmailFriendForm, UserTestResultForm, \
27  
-    SubtitlesUploadForm, PasteTranscriptionForm, CreateVideoUrlForm, TranscriptionFileForm, \
  27
+    SubtitlesUploadForm, CreateVideoUrlForm, TranscriptionFileForm, \
28 28
     AddFromFeedForm
29 29
 import widget
30 30
 from django.contrib.sites.models import Site
@@ -295,18 +295,6 @@ def upload_subtitles(request):
295 295
     return HttpResponse(u'<textarea>%s</textarea>'  % json.dumps(output))
296 296
 
297 297
 @login_required
298  
-def paste_transcription(request):
299  
-    output = dict(success=False)
300  
-    form = PasteTranscriptionForm(request.user, request.POST)
301  
-    if form.is_valid():
302  
-        language = form.save()
303  
-        output['success'] = True
304  
-        output['next'] = language.get_absolute_url()
305  
-    else:
306  
-        output['errors'] = form.get_errors()
307  
-    return HttpResponse(json.dumps(output), "text/javascript")
308  
-
309  
-@login_required
310 298
 def upload_transcription_file(request):
311 299
     output = {}
312 300
     form = TranscriptionFileForm(request.POST, request.FILES)
7  apps/widget/rpc.py
@@ -551,7 +551,7 @@ def _copy_subtitles(self, source_version, dest_version):
551 551
         for s in source_version.subtitle_set.all():
552 552
             s.duplicate_for(dest_version).save()
553 553
 
554  
-    def _get_new_version_for_save(self, subtitles, language, session, user, forked, new_title, new_description):
  554
+    def _get_new_version_for_save(self, subtitles, language, session, user, forked, new_title, new_description, save_for_later=None):
555 555
         """Return a new subtitle version for this save, or None if not needed."""
556 556
 
557 557
         new_version = None
@@ -583,10 +583,9 @@ def _get_new_version_for_save(self, subtitles, language, session, user, forked,
583 583
             else:
584 584
                 self._copy_subtitles(previous_version, new_version)
585 585
 
586  
-
587 586
             # this is really really hackish.
588 587
             # TODO: clean all this mess on a friday
589  
-            if not new_version.is_synced():
  588
+            if not new_version.is_synced() or save_for_later:
590 589
                 self._moderate_incomplete_version(new_version, user)
591 590
             elif should_create_task:
592 591
                 self._create_review_or_approve_task(new_version)
@@ -622,7 +621,7 @@ def save_finished(self, request, user, session, subtitles, new_title=None,
622 621
 
623 622
         new_version = self._get_new_version_for_save(
624 623
             subtitles, language, session, user, forked, new_title,
625  
-            new_description)
  624
+            new_description, save_for_later)
626 625
 
627 626
         language.release_writelock()
628 627
 
52  templates/videos/_left_navigation.html
... ...
@@ -1,30 +1,34 @@
1  
-{% load i18n subtitles_tags doorman %}
  1
+{% load i18n subtitles_tags doorman videos_tags %}
2 2
 
3  
-{% if video.subtitle_language %}
4  
-    <li class="{% complete_color video.subtitle_language %}{% if language.is_original %} active{% endif %}">
5  
-        <a href="{% language_url request video.subtitle_language %}">
6  
-            <span class="done_indicator"></span>
7  
-            {{ video.subtitle_language.language_display }}
8  
-            {% if video.subtitle_language.has_version %}
9  
-                <span class="done_percentage">({% complete_indicator video.subtitle_language %})</span>
10  
-            {% else %}
11  
-                <span class="done_percentage">(in progress)</span>
12  
-            {% endif %}
13  
-        </a>
14  
-    </li>
15  
-{% endif %}
  3
+{% with lang=video.subtitle_language %}
  4
+    {% if lang %}
  5
+        {% if lang.has_version or lang|in_progress %}
  6
+            <li class="{% complete_color video.subtitle_language %}{% if language.is_original %} active{% endif %}">
  7
+                <a href="{% language_url request video.subtitle_language %}">
  8
+                    <span class="done_indicator"></span>
  9
+                    {{ video.subtitle_language.language_display }}
  10
+                    <span class="done_percentage">({% complete_indicator video.subtitle_language %})</span>
  11
+                    {% if lang|in_progress %}
  12
+                        <span class="done_percentage">(in progress)</span>
  13
+                    {% endif %}
  14
+                </a>
  15
+            </li>
  16
+        {% endif %}
  17
+    {% endif %}
  18
+{% endwith %}
16 19
 {% if translations %}
17 20
     {% for item in translations %}
18  
-        <li class="{% complete_color item %}{% if language == item %} active{% endif %} {% if forloop.counter > 14 %}hidden{% endif %}">
19  
-            <a href="{% language_url request item %}">
20  
-                <span class="done_indicator"></span>
21  
-                {{ item.get_language_display }}
22  
-                {% if item.has_version %}
  21
+        {% if item.has_version or item|in_progress %}
  22
+            <li class="{% complete_color item %}{% if language == item %} active{% endif %} {% if forloop.counter > 14 %}hidden{% endif %}">
  23
+                <a href="{% language_url request item %}">
  24
+                    <span class="done_indicator"></span>
  25
+                    {{ item.get_language_display }}
23 26
                     <span class="done_percentage">({% complete_indicator item %})</span>
24  
-                {% else %}
25  
-                    <span class="done_percentage">(in progress)</span>
26  
-                {% endif %}
27  
-            </a>
28  
-        </li>
  27
+                    {% if item|in_progress %}
  28
+                        <span class="done_percentage">(in progress)</span>
  29
+                    {% endif %}
  30
+                </a>
  31
+            </li>
  32
+        {% endif %}
29 33
     {% endfor %}
30 34
 {% endif %}
19  templates/videos/_paste_transcription.html
@@ -139,25 +139,6 @@
139 139
                 <input class="ajax-file-upload-field" type="file"  name="txtfile" id="id_txtfile"/>
140 140
             </p>
141 141
         </form>
142  
-        <form method="post" action="{% url videos:paste_transcription %}" id="upload-transcript-form">
143  
-            {% csrf_token %}
144  
-            <p>
145  
-                <input type="hidden" name="video" value="{{ video.id }}" />
146  
-                <label>{% trans 'Language' %}</label>{{ form.language }}
147  
-            </p>
148  
-            {% if not video.has_original_language %}
149  
-            <p>
150  
-                <label>{% trans 'Video Language' %}</label>{{ form.video_language }}
151  
-            </p>
152  
-            {% endif %}
153  
-            <p>           
154  
-                <textarea rows="8" style="width: 355px" name="subtitles" class="upload-transcript-textarea"></textarea>
155  
-            </p> 
156  
-            <p>  
157  
-                <button class="green_button big floatright">{% trans 'Submit Transcript' %}</button>
158  
-                <span class="save-indicator" style="display: none">{% trans 'Saving...' %}</span>
159  
-            </p> 
160  
-        </form>
161 142
         {% else %}
162 143
             <a href="{% url auth:login %}?next={{ request.path_info }}">
163 144
                 {% trans 'Login to upload subtitles' %}
5  templates/videos/_upload_subtitles.html
@@ -9,11 +9,8 @@
9 9
             <p>
10 10
               {% blocktrans %}
11 11
               Our site accepts SRT, SSA, SBV, DFXP and TTML format. Only files ending in .srt, .ssa, .sbv, .dfxp
12  
-              or .xml (for TTML) are accepted. Or you can
  12
+              or .xml (for TTML) are accepted.
13 13
               {% endblocktrans %}
14  
-              <a href="#" data-modal="upload-transcript" class="upload-transcript-button">
15  
-                  {% trans 'paste in a transcript' %}
16  
-              </a>
17 14
             </p>
18 15
                 <div id="upload-subtitles-div">
19 16
                     <form method="post" id="upload-subtitles-form" action="{% url videos:upload_subtitles %}" enctype="multipart/form-data">
1  templates/videos/video-view.html
@@ -164,7 +164,6 @@ <h2 class="main-title">
164 164
                             {% endif %}
165 165
                             {% if can_create_subs or can_create_trans %}
166 166
                                 {% upload_subtitles video %}
167  
-                                {% paste_transcription %}
168 167
                             {% else %}
169 168
                                 {% trans 'Subtitles for this video are moderated. If it belongs to a team, try joining the team to contribute.' %}
170 169
                             {% endif %}

0 notes on commit d04d12b

Please sign in to comment.
Something went wrong with that request. Please try again.