diff --git a/edxval/admin.py b/edxval/admin.py index 4fff51bb..ec551153 100644 --- a/edxval/admin.py +++ b/edxval/admin.py @@ -115,6 +115,8 @@ class TranscriptPreferenceAdmin(admin.ModelAdmin): class ThirdPartyTranscriptCredentialsStateAdmin(admin.ModelAdmin): """ Admin for ThirdPartyTranscriptCredentialsState """ + # TODO: change "exists" to "has_creds" once the new column exists, in step 3 + # of the renaming process. list_display = ('org', 'provider', 'exists', 'created', 'modified') model = ThirdPartyTranscriptCredentialsState diff --git a/edxval/api.py b/edxval/api.py index 99e948de..39ad449a 100644 --- a/edxval/api.py +++ b/edxval/api.py @@ -224,6 +224,7 @@ def get_transcript_credentials_state_for_org(org, provider=None): query_filter['provider'] = provider return { + # TODO: rename credential.exists to credential.has_creds in step 3 of renaming. credential.provider: credential.exists for credential in ThirdPartyTranscriptCredentialsState.objects.filter(**query_filter) } @@ -510,7 +511,7 @@ def create_profile(profile_name): """ Used to create Profile objects in the database - A profile needs to exists before an EncodedVideo object can be created. + A profile needs to exist before an EncodedVideo object can be created. Args: profile_name (str): ID of the profile diff --git a/edxval/migrations/0012_thirdpartytranscriptcredentialsstate_has_creds.py b/edxval/migrations/0012_thirdpartytranscriptcredentialsstate_has_creds.py new file mode 100644 index 00000000..0d6ce49d --- /dev/null +++ b/edxval/migrations/0012_thirdpartytranscriptcredentialsstate_has_creds.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.25 on 2019-12-03 05:48 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('edxval', '0011_data__add_audio_mp3_profile'), + ] + + operations = [ + migrations.AddField( + model_name='thirdpartytranscriptcredentialsstate', + name='has_creds', + field=models.BooleanField(default=False, help_text='Transcript credentials state'), + ), + ] diff --git a/edxval/models.py b/edxval/models.py index 9b231a49..d94f4bc1 100644 --- a/edxval/models.py +++ b/edxval/models.py @@ -659,17 +659,20 @@ class Meta: max_length=20, choices=TranscriptProviderType.CHOICES, ) + # TODO remove exists in step 3 of renaming. exists = models.BooleanField(default=False, help_text=u'Transcript credentials state') + has_creds = models.BooleanField(default=False, help_text=u'Transcript credentials state') @classmethod - def update_or_create(cls, org, provider, exists): + def update_or_create(cls, org, provider, has_creds): """ Update or create credentials state. """ + # TODO: remove 'exists' in step 3 of renaming. instance, created = cls.objects.update_or_create( org=org, provider=provider, - defaults={'exists': exists}, + defaults={'exists': has_creds, 'has_creds': has_creds}, ) return instance, created @@ -682,6 +685,7 @@ def __str__(self): edX has Cielo24 credentials edX doesn't have 3PlayMedia credentials """ + # TODO: rename exists to has_creds in set 3 of renaming. return u'{org} {state} {provider} credentials'.format( org=self.org, provider=self.provider, state='has' if self.exists else "doesn't have" ) diff --git a/edxval/tests/test_api.py b/edxval/tests/test_api.py index 802a26d0..356f49bf 100644 --- a/edxval/tests/test_api.py +++ b/edxval/tests/test_api.py @@ -3014,11 +3014,12 @@ def setUp(self): Tests setup """ super(TranscripCredentialsStateTest, self).setUp() + # TODO: remove exists in step 3 of renaming. third_party_trans_true = ThirdPartyTranscriptCredentialsState.objects.create( - org='edX', provider='Cielo24', exists=True + org='edX', provider='Cielo24', exists=True, has_creds=True ) third_party_trans_false = ThirdPartyTranscriptCredentialsState.objects.create( - org='edX', provider='3PlayMedia', exists=False + org='edX', provider='3PlayMedia', exists=False, has_creds=False ) # casting an instance to a string returns a valid value. diff --git a/setup.py b/setup.py index 07fb524c..77978804 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ def load_requirements(*requirements_paths): return list(requirements) -VERSION = '1.1.30' +VERSION = '1.1.31' if sys.argv[-1] == 'tag': print("Tagging the version on github:")