Permalink
Browse files

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

  • Loading branch information...
2 parents bc24cd3 + cfbfcb3 commit d04d12b4097009decc853f0d71afd560e795d8cc @sjl sjl committed Jun 11, 2012
View
303 apps/teams/migrations/0097_add_index_on_tasks_for_team_and_expiration.py
@@ -0,0 +1,303 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import DataMigration
+from django.db import models
+
+class Migration(DataMigration):
+
+ def forwards(self, orm):
+ db.create_index('teams_task', ['team_id', 'expiration_date'])
+
+ def backwards(self, orm):
+ db.delete_index('teams_task', ['team_id', 'expiration_date'])
+
+
+ models = {
+ 'accountlinker.thirdpartyaccount': {
+ 'Meta': {'unique_together': "(('type', 'username'),)", 'object_name': 'ThirdPartyAccount'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'oauth_access_token': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
+ 'oauth_refresh_token': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
+ 'type': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
+ 'username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
+ },
+ 'auth.customuser': {
+ 'Meta': {'object_name': 'CustomUser', '_ormbases': ['auth.User']},
+ 'autoplay_preferences': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+ 'award_points': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'biography': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'full_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '63', 'blank': 'True'}),
+ 'homepage': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+ 'is_partner': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'last_ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
+ 'notify_by_email': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'notify_by_message': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'partner': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '32', 'null': 'True', 'blank': 'True'}),
+ 'picture': ('utils.amazon.fields.S3EnabledImageField', [], {'thumb_options': "{'upscale': True, 'crop': 'smart'}", 'max_length': '100', 'blank': 'True'}),
+ 'preferred_language': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
+ 'user_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['auth.User']", 'unique': 'True', 'primary_key': 'True'}),
+ 'valid_email': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'videos': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['videos.Video']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.group': {
+ 'Meta': {'object_name': 'Group'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
+ 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
+ },
+ 'auth.permission': {
+ 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
+ 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+ },
+ 'auth.user': {
+ 'Meta': {'object_name': 'User'},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
+ },
+ 'contenttypes.contenttype': {
+ 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+ },
+ 'teams.application': {
+ 'Meta': {'unique_together': "(('team', 'user'),)", 'object_name': 'Application'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'note': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'team': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'applications'", 'to': "orm['teams.Team']"}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'team_applications'", 'to': "orm['auth.CustomUser']"})
+ },
+ 'teams.invite': {
+ 'Meta': {'unique_together': "(('team', 'user'),)", 'object_name': 'Invite'},
+ 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'note': ('django.db.models.fields.TextField', [], {'max_length': '200', 'blank': 'True'}),
+ 'role': ('django.db.models.fields.CharField', [], {'default': "'contributor'", 'max_length': '16'}),
+ 'team': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'invitations'", 'to': "orm['teams.Team']"}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'team_invitations'", 'to': "orm['auth.CustomUser']"})
+ },
+ 'teams.membershipnarrowing': {
+ 'Meta': {'object_name': 'MembershipNarrowing'},
+ 'added_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'narrowing_includer'", 'null': 'True', 'to': "orm['teams.TeamMember']"}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'language': ('django.db.models.fields.CharField', [], {'max_length': '24', 'blank': 'True'}),
+ 'member': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'narrowings'", 'to': "orm['teams.TeamMember']"}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Project']", 'null': 'True', 'blank': 'True'})
+ },
+ 'teams.project': {
+ 'Meta': {'unique_together': "(('team', 'name'), ('team', 'slug'))", 'object_name': 'Project'},
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}),
+ 'guidelines': ('django.db.models.fields.TextField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'blank': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '50', 'blank': 'True'}),
+ 'team': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Team']"}),
+ 'workflow_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'})
+ },
+ 'teams.setting': {
+ 'Meta': {'unique_together': "(('key', 'team'),)", 'object_name': 'Setting'},
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'data': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'team': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'settings'", 'to': "orm['teams.Team']"})
+ },
+ 'teams.task': {
+ 'Meta': {'object_name': 'Task'},
+ 'approved': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'assignee': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']", 'null': 'True', 'blank': 'True'}),
+ 'body': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+ 'completed': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'expiration_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'language': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '16', 'blank': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'priority': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True', 'blank': 'True'}),
+ 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'review_base_version': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'tasks_based_on'", 'null': 'True', 'to': "orm['videos.SubtitleVersion']"}),
+ 'subtitle_version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.SubtitleVersion']", 'null': 'True', 'blank': 'True'}),
+ 'team': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Team']"}),
+ 'team_video': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.TeamVideo']"}),
+ 'type': ('django.db.models.fields.PositiveIntegerField', [], {})
+ },
+ 'teams.team': {
+ 'Meta': {'object_name': 'Team'},
+ 'applicants': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'applicated_teams'", 'symmetrical': 'False', 'through': "orm['teams.Application']", 'to': "orm['auth.CustomUser']"}),
+ 'application_text': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'auth_provider_code': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '24', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'header_html_text': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+ 'highlight': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_moderated': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'is_visible': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'last_notification_time': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'logo': ('utils.amazon.fields.S3EnabledImageField', [], {'thumb_options': "{'upscale': True, 'autocrop': True}", 'max_length': '100', 'blank': 'True'}),
+ 'max_tasks_per_member': ('django.db.models.fields.PositiveIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+ 'membership_policy': ('django.db.models.fields.IntegerField', [], {'default': '4'}),
+ 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '250'}),
+ 'page_content': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'points': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'projects_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),
+ 'subtitle_policy': ('django.db.models.fields.IntegerField', [], {'default': '10'}),
+ 'task_assign_policy': ('django.db.models.fields.IntegerField', [], {'default': '10'}),
+ 'task_expiration': ('django.db.models.fields.PositiveIntegerField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+ 'third_party_accounts': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'tseams'", 'symmetrical': 'False', 'to': "orm['accountlinker.ThirdPartyAccount']"}),
+ 'translate_policy': ('django.db.models.fields.IntegerField', [], {'default': '10'}),
+ 'users': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'teams'", 'symmetrical': 'False', 'through': "orm['teams.TeamMember']", 'to': "orm['auth.CustomUser']"}),
+ 'video': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'intro_for_teams'", 'null': 'True', 'to': "orm['videos.Video']"}),
+ 'video_policy': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+ 'videos': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['videos.Video']", 'through': "orm['teams.TeamVideo']", 'symmetrical': 'False'}),
+ 'workflow_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'})
+ },
+ 'teams.teamlanguagepreference': {
+ 'Meta': {'unique_together': "(('team', 'language_code'),)", 'object_name': 'TeamLanguagePreference'},
+ 'allow_reads': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'allow_writes': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'language_code': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
+ 'preferred': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'team': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'lang_preferences'", 'to': "orm['teams.Team']"})
+ },
+ 'teams.teammember': {
+ 'Meta': {'unique_together': "(('team', 'user'),)", 'object_name': 'TeamMember'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'role': ('django.db.models.fields.CharField', [], {'default': "'contributor'", 'max_length': '16', 'db_index': 'True'}),
+ 'team': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'members'", 'to': "orm['teams.Team']"}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'team_members'", 'to': "orm['auth.CustomUser']"})
+ },
+ 'teams.teamnotificationsetting': {
+ 'Meta': {'object_name': 'TeamNotificationSetting'},
+ 'basic_auth_password': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'basic_auth_username': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'notification_class': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+ 'request_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'team': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'notification_settings'", 'unique': 'True', 'to': "orm['teams.Team']"})
+ },
+ 'teams.teamvideo': {
+ 'Meta': {'unique_together': "(('team', 'video'),)", 'object_name': 'TeamVideo'},
+ 'added_by': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']"}),
+ 'all_languages': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'completed_languages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['videos.SubtitleLanguage']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Project']"}),
+ 'team': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Team']"}),
+ 'thumbnail': ('utils.amazon.fields.S3EnabledImageField', [], {'max_length': '100', 'thumb_options': "{'upscale': True, 'crop': 'smart'}", 'null': 'True', 'thumb_sizes': '((290, 165), (120, 90))', 'blank': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}),
+ 'video': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['videos.Video']", 'unique': 'True'})
+ },
+ 'teams.workflow': {
+ 'Meta': {'unique_together': "(('team', 'project', 'team_video'),)", 'object_name': 'Workflow'},
+ 'approve_allowed': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'autocreate_subtitle': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'autocreate_translate': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Project']", 'null': 'True', 'blank': 'True'}),
+ 'review_allowed': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'team': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.Team']"}),
+ 'team_video': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['teams.TeamVideo']", 'null': 'True', 'blank': 'True'})
+ },
+ 'videos.subtitlelanguage': {
+ 'Meta': {'unique_together': "(('video', 'language', 'standard_language'),)", 'object_name': 'SubtitleLanguage'},
+ 'created': ('django.db.models.fields.DateTimeField', [], {}),
+ 'followers': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'followed_languages'", 'blank': 'True', 'to': "orm['auth.CustomUser']"}),
+ 'had_version': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'has_version': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'is_forked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'is_original': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'language': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
+ 'percent_done': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'standard_language': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.SubtitleLanguage']", 'null': 'True', 'blank': 'True'}),
+ 'subtitle_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'subtitles_fetched_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'video': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.Video']"}),
+ 'writelock_owner': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']", 'null': 'True', 'blank': 'True'}),
+ 'writelock_session_key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
+ 'writelock_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'})
+ },
+ 'videos.subtitleversion': {
+ 'Meta': {'unique_together': "(('language', 'version_no'),)", 'object_name': 'SubtitleVersion'},
+ 'datetime_started': ('django.db.models.fields.DateTimeField', [], {}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'forked_from': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.SubtitleVersion']", 'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_forked': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'language': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['videos.SubtitleLanguage']"}),
+ 'moderation_status': ('django.db.models.fields.CharField', [], {'default': "'not__under_moderation'", 'max_length': '32', 'db_index': 'True'}),
+ 'note': ('django.db.models.fields.CharField', [], {'max_length': '512', 'blank': 'True'}),
+ 'notification_sent': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'result_of_rollback': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'text_change': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'time_change': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']"}),
+ 'version_no': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
+ },
+ 'videos.video': {
+ 'Meta': {'object_name': 'Video'},
+ 'allow_community_edits': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'allow_video_urls_edit': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'complete_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+ 'duration': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'edited': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'featured': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'followers': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'followed_videos'", 'blank': 'True', 'to': "orm['auth.CustomUser']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
+ 'is_subtitled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
+ 'languages_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'moderated_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'moderating'", 'null': 'True', 'to': "orm['teams.Team']"}),
+ 's3_thumbnail': ('utils.amazon.fields.S3EnabledImageField', [], {'thumb_options': "{'upscale': True, 'crop': 'smart'}", 'max_length': '100', 'thumb_sizes': '((290, 165), (120, 90))', 'blank': 'True'}),
+ 'small_thumbnail': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}),
+ 'subtitles_fetched_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'thumbnail': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '2048', 'blank': 'True'}),
+ 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.CustomUser']", 'null': 'True', 'blank': 'True'}),
+ 'video_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
+ 'view_count': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'was_subtitled': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
+ 'widget_views_count': ('django.db.models.fields.IntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'writelock_owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'writelock_owners'", 'null': 'True', 'to': "orm['auth.CustomUser']"}),
+ 'writelock_session_key': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'writelock_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True'})
+ }
+ }
+
+ complete_apps = ['teams']
View
19 apps/videos/forms.py
@@ -479,25 +479,6 @@ def save(self):
return sl
-class PasteTranscriptionForm(SubtitlesUploadBaseForm):
- subtitles = forms.CharField()
-
- def save(self):
- subtitles = self.cleaned_data['subtitles']
- parser = TxtSubtitleParser(subtitles)
- language = self.save_subtitles(parser, update_video=False, is_complete=False)
-
- self.verify_tasks(is_complete=False)
-
- latest_version = language.latest_version()
-
- if latest_version:
- video_changed_tasks.delay(language.video_id, language.latest_version().id)
- else:
- video_changed_tasks.delay(language.video_id)
-
- return language
-
class UserTestResultForm(forms.ModelForm):
class Meta:
View
18 apps/videos/templatetags/subtitles_tags.py
@@ -20,7 +20,7 @@
from django.utils.translation import ugettext_lazy as _, ungettext
from django.utils import translation
-from videos.forms import SubtitlesUploadForm, PasteTranscriptionForm, CreateVideoUrlForm
+from videos.forms import SubtitlesUploadForm, CreateVideoUrlForm
from icanhaz.models import VideoVisibilityPolicy
register = template.Library()
@@ -41,22 +41,6 @@ def upload_subtitles(context, video):
context['form'] = SubtitlesUploadForm(context['user'], initial=initial)
return context
-@register.inclusion_tag('videos/_paste_transcription.html', takes_context=True)
-def paste_transcription(context):
- #It is just template of pop-up, you should add link with 'upload-transcript-button' class
- initial = {}
- if context.get('language') and context['language'].language:
- initial['language'] = context['language'].language
- else:
- initial['language'] = translation.get_language()
-
- original_language = context['video'].subtitle_language()
- if original_language and original_language.language:
- initial['video_language'] = original_language.language
-
- context['form'] = PasteTranscriptionForm(context['user'], initial=initial)
- return context
-
@register.simple_tag
def complete_indicator(language, mode='normal'):
if language.is_original or language.is_forked:
View
4 apps/videos/templatetags/videos_tags.py
@@ -97,6 +97,10 @@ def video_url(parser, token, node_cls=VideoURLNode):
asvar=node_instance.asvar)
video_url = register.tag(video_url)
+@register.filter
+def in_progress(language):
+ return language.latest_version(False)
+
@register.inclusion_tag("videos/_visibility_control_button.html")
def render_visibility_button(video, user):
View
46 apps/videos/tests.py
@@ -920,7 +920,6 @@ def test_access_video_page_no_original(self):
# with blank language codes.
self.assertEqual(response.status_code, 302)
-
def test_bliptv_twice(self):
VIDEO_FILE = 'http://blip.tv/file/get/Kipkay-AirDusterOfficeWeaponry223.m4v'
old_video_file_url = blip.video_file_url
@@ -942,49 +941,6 @@ def test_subscribe_to_updates(self):
# TODO: write test
pass
- def test_paste_transcription(self):
- user1 = User.objects.get(username='admin1')
- self.client.login(username='admin1', password='admin')
-
- self.assertFalse(self.video.followers.filter(pk=user1.pk).exists())
-
- mail.outbox = []
-
- language_code = u"el"
-
- data = {
- "video": u"1",
- "subtitles": u"""#1
-
-#2""",
- "language": language_code,
- "video_language": u"en"
- }
- language = self.video.subtitle_language(language_code)
- self.assertEquals(language, None)
- response = self.client.post(reverse("videos:paste_transcription"), data)
- self.failUnlessEqual(response.status_code, 200)
-
- language = self.video.subtitle_language(language_code)
- version = language.latest_version(public_only=False)
- self.assertEqual(len(version.subtitles()), 2)
-
- def test_paste_transcription_windows(self):
- self._login()
-
- language_code = u"el"
-
- data = {
- "video": u"1",
- "subtitles": u"#1\r\n\r\n#2",
- "language": language_code,
- "video_language": u"en"
- }
- self.client.post(reverse("videos:paste_transcription"), data)
- language = self.video.subtitle_language(language_code)
- version = language.latest_version(public_only=True)
- self.assertEqual(len(version.subtitles()), 2)
-
def test_email_friend(self):
self._simple_test('videos:email_friend')
@@ -1087,7 +1043,6 @@ def test_rollback_updates_sub_count(self):
final_num_subs = len(last_v.subtitles())
self.assertEqual(final_num_subs, num_subs)
-
def test_diffing(self):
version = self.video.version(version_no=0)
last_version = self.video.version()
@@ -1111,7 +1066,6 @@ def test_test_form_page(self):
except UserTestResult.DoesNotExist:
self.fail()
-
def test_search(self):
self._simple_test('search:index')
View
1 apps/videos/urls.py
@@ -36,7 +36,6 @@
url(r'^feedback/$', 'feedback', name='feedback'),
url(r'^feedback/error/$', 'feedback', {'hide_captcha': True}, 'feedback_error'),
url(r'^upload_subtitles/$', 'upload_subtitles', name='upload_subtitles'),
- url(r'^paste_transcription/$', 'paste_transcription', name='paste_transcription'),
url(r'^upload_transcription_file/$', 'upload_transcription_file', name='upload_transcription_file'),
url(r'^create/$', 'create', name='create'),
url(r'^create/feed/$', 'create_from_feed', name='create_from_feed'),
View
14 apps/videos/views.py
@@ -24,7 +24,7 @@
from videos.models import Video, Action, SubtitleLanguage, SubtitleVersion, \
VideoUrl, AlreadyEditingException, restrict_versions
from videos.forms import VideoForm, FeedbackForm, EmailFriendForm, UserTestResultForm, \
- SubtitlesUploadForm, PasteTranscriptionForm, CreateVideoUrlForm, TranscriptionFileForm, \
+ SubtitlesUploadForm, CreateVideoUrlForm, TranscriptionFileForm, \
AddFromFeedForm
import widget
from django.contrib.sites.models import Site
@@ -295,18 +295,6 @@ def upload_subtitles(request):
return HttpResponse(u'<textarea>%s</textarea>' % json.dumps(output))
@login_required
-def paste_transcription(request):
- output = dict(success=False)
- form = PasteTranscriptionForm(request.user, request.POST)
- if form.is_valid():
- language = form.save()
- output['success'] = True
- output['next'] = language.get_absolute_url()
- else:
- output['errors'] = form.get_errors()
- return HttpResponse(json.dumps(output), "text/javascript")
-
-@login_required
def upload_transcription_file(request):
output = {}
form = TranscriptionFileForm(request.POST, request.FILES)
View
7 apps/widget/rpc.py
@@ -551,7 +551,7 @@ def _copy_subtitles(self, source_version, dest_version):
for s in source_version.subtitle_set.all():
s.duplicate_for(dest_version).save()
- def _get_new_version_for_save(self, subtitles, language, session, user, forked, new_title, new_description):
+ def _get_new_version_for_save(self, subtitles, language, session, user, forked, new_title, new_description, save_for_later=None):
"""Return a new subtitle version for this save, or None if not needed."""
new_version = None
@@ -583,10 +583,9 @@ def _get_new_version_for_save(self, subtitles, language, session, user, forked,
else:
self._copy_subtitles(previous_version, new_version)
-
# this is really really hackish.
# TODO: clean all this mess on a friday
- if not new_version.is_synced():
+ if not new_version.is_synced() or save_for_later:
self._moderate_incomplete_version(new_version, user)
elif should_create_task:
self._create_review_or_approve_task(new_version)
@@ -622,7 +621,7 @@ def save_finished(self, request, user, session, subtitles, new_title=None,
new_version = self._get_new_version_for_save(
subtitles, language, session, user, forked, new_title,
- new_description)
+ new_description, save_for_later)
language.release_writelock()
View
52 templates/videos/_left_navigation.html
@@ -1,30 +1,34 @@
-{% load i18n subtitles_tags doorman %}
+{% load i18n subtitles_tags doorman videos_tags %}
-{% if video.subtitle_language %}
- <li class="{% complete_color video.subtitle_language %}{% if language.is_original %} active{% endif %}">
- <a href="{% language_url request video.subtitle_language %}">
- <span class="done_indicator"></span>
- {{ video.subtitle_language.language_display }}
- {% if video.subtitle_language.has_version %}
- <span class="done_percentage">({% complete_indicator video.subtitle_language %})</span>
- {% else %}
- <span class="done_percentage">(in progress)</span>
- {% endif %}
- </a>
- </li>
-{% endif %}
+{% with lang=video.subtitle_language %}
+ {% if lang %}
+ {% if lang.has_version or lang|in_progress %}
+ <li class="{% complete_color video.subtitle_language %}{% if language.is_original %} active{% endif %}">
+ <a href="{% language_url request video.subtitle_language %}">
+ <span class="done_indicator"></span>
+ {{ video.subtitle_language.language_display }}
+ <span class="done_percentage">({% complete_indicator video.subtitle_language %})</span>
+ {% if lang|in_progress %}
+ <span class="done_percentage">(in progress)</span>
+ {% endif %}
+ </a>
+ </li>
+ {% endif %}
+ {% endif %}
+{% endwith %}
{% if translations %}
{% for item in translations %}
- <li class="{% complete_color item %}{% if language == item %} active{% endif %} {% if forloop.counter > 14 %}hidden{% endif %}">
- <a href="{% language_url request item %}">
- <span class="done_indicator"></span>
- {{ item.get_language_display }}
- {% if item.has_version %}
+ {% if item.has_version or item|in_progress %}
+ <li class="{% complete_color item %}{% if language == item %} active{% endif %} {% if forloop.counter > 14 %}hidden{% endif %}">
+ <a href="{% language_url request item %}">
+ <span class="done_indicator"></span>
+ {{ item.get_language_display }}
<span class="done_percentage">({% complete_indicator item %})</span>
- {% else %}
- <span class="done_percentage">(in progress)</span>
- {% endif %}
- </a>
- </li>
+ {% if item|in_progress %}
+ <span class="done_percentage">(in progress)</span>
+ {% endif %}
+ </a>
+ </li>
+ {% endif %}
{% endfor %}
{% endif %}
View
19 templates/videos/_paste_transcription.html
@@ -139,25 +139,6 @@
<input class="ajax-file-upload-field" type="file" name="txtfile" id="id_txtfile"/>
</p>
</form>
- <form method="post" action="{% url videos:paste_transcription %}" id="upload-transcript-form">
- {% csrf_token %}
- <p>
- <input type="hidden" name="video" value="{{ video.id }}" />
- <label>{% trans 'Language' %}</label>{{ form.language }}
- </p>
- {% if not video.has_original_language %}
- <p>
- <label>{% trans 'Video Language' %}</label>{{ form.video_language }}
- </p>
- {% endif %}
- <p>
- <textarea rows="8" style="width: 355px" name="subtitles" class="upload-transcript-textarea"></textarea>
- </p>
- <p>
- <button class="green_button big floatright">{% trans 'Submit Transcript' %}</button>
- <span class="save-indicator" style="display: none">{% trans 'Saving...' %}</span>
- </p>
- </form>
{% else %}
<a href="{% url auth:login %}?next={{ request.path_info }}">
{% trans 'Login to upload subtitles' %}
View
5 templates/videos/_upload_subtitles.html
@@ -9,11 +9,8 @@
<p>
{% blocktrans %}
Our site accepts SRT, SSA, SBV, DFXP and TTML format. Only files ending in .srt, .ssa, .sbv, .dfxp
- or .xml (for TTML) are accepted. Or you can
+ or .xml (for TTML) are accepted.
{% endblocktrans %}
- <a href="#" data-modal="upload-transcript" class="upload-transcript-button">
- {% trans 'paste in a transcript' %}
- </a>
</p>
<div id="upload-subtitles-div">
<form method="post" id="upload-subtitles-form" action="{% url videos:upload_subtitles %}" enctype="multipart/form-data">
View
1 templates/videos/video-view.html
@@ -164,7 +164,6 @@ <h2 class="main-title">
{% endif %}
{% if can_create_subs or can_create_trans %}
{% upload_subtitles video %}
- {% paste_transcription %}
{% else %}
{% trans 'Subtitles for this video are moderated. If it belongs to a team, try joining the team to contribute.' %}
{% endif %}

0 comments on commit d04d12b

Please sign in to comment.