Skip to content

Commit

Permalink
Merge pull request #687 from edx/zulqarnain/BOM-1153
Browse files Browse the repository at this point in the history
BOM-1153 : Applied django codemods to edx-enterprise
  • Loading branch information
M Zulqarnain authored Jan 24, 2020
2 parents 2c12bb9 + f5f9dab commit f98bcbf
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

from __future__ import absolute_import, unicode_literals

__version__ = "2.1.01"
__version__ = "2.1.02"

default_app_config = "enterprise.apps.EnterpriseConfig" # pylint: disable=invalid-name
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='enrollmentnotificationemailtemplate',
name='enterprise_customer',
field=models.OneToOneField(related_name='enterprise_enrollment_template', default=None, to='enterprise.EnterpriseCustomer'),
field=models.OneToOneField(related_name='enterprise_enrollment_template', default=None, to='enterprise.EnterpriseCustomer', on_delete=models.CASCADE),
preserve_default=False,
),
migrations.AddField(
Expand All @@ -26,6 +26,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='enrollmentnotificationemailtemplate',
name='site',
field=models.OneToOneField(related_name='enterprise_enrollment_template', null=True, blank=True, to='sites.Site'),
field=models.OneToOneField(related_name='enterprise_enrollment_template', null=True, blank=True, to='sites.Site', on_delete=models.CASCADE),
),
]
2 changes: 1 addition & 1 deletion enterprise/migrations/0029_auto_20170925_1909.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='enterprisecustomercatalog',
name='enterprise_customer',
field=models.ForeignKey(related_name='enterprise_customer_catalogs', to='enterprise.EnterpriseCustomer'),
field=models.ForeignKey(related_name='enterprise_customer_catalogs', to='enterprise.EnterpriseCustomer', on_delete=models.CASCADE),
),
]
2 changes: 1 addition & 1 deletion enterprise/migrations/0032_reporting_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Migration(migrations.Migration):
('hour_of_day', models.SmallIntegerField(help_text='The hour of the day to send the report, in Eastern Standard Time (EST). This is required for all frequency settings.', verbose_name='Hour of Day', validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(23)])),
('initialization_vector', models.BinaryField(help_text='This is the initialization vector used to encrypt the password using AESencr', verbose_name='Password Encryption Initialization Vector', max_length=32)),
('password', models.BinaryField(verbose_name='Password', max_length=256)),
('enterprise_customer', models.OneToOneField(verbose_name='Enterprise Customer', to='enterprise.EnterpriseCustomer')),
('enterprise_customer', models.OneToOneField(verbose_name='Enterprise Customer', to='enterprise.EnterpriseCustomer', on_delete=models.CASCADE)),
],
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='enterprisecustomerreportingconfiguration',
name='enterprise_customer',
field=models.ForeignKey(related_name='reporting_configurations', verbose_name='Enterprise Customer', to='enterprise.EnterpriseCustomer'),
field=models.ForeignKey(related_name='reporting_configurations', verbose_name='Enterprise Customer', to='enterprise.EnterpriseCustomer', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='enterprisecustomerreportingconfiguration',
Expand Down
6 changes: 3 additions & 3 deletions enterprise/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class Meta:
default=get_default_customer_type,
help_text=_(
'Specifies enterprise customer type.'
)
), on_delete=models.CASCADE
)

enable_portal_code_management_screen = models.BooleanField( # pylint: disable=invalid-name
Expand Down Expand Up @@ -856,7 +856,7 @@ class PendingEnterpriseCustomerUser(TimeStampedModel):
.. pii_retirement: local_api, consumer_api
""" # pylint: enable=line-too-long

enterprise_customer = models.ForeignKey(EnterpriseCustomer, blank=False, null=False)
enterprise_customer = models.ForeignKey(EnterpriseCustomer, blank=False, null=False, on_delete=models.CASCADE)
user_email = models.EmailField(null=False, blank=False, unique=True)
history = HistoricalRecords()

Expand Down Expand Up @@ -1074,7 +1074,7 @@ class EnterpriseCustomerIdentityProvider(TimeStampedModel):
EnterpriseCustomer,
blank=False,
null=False,
related_name="enterprise_customer_identity_provider"
related_name="enterprise_customer_identity_provider", on_delete=models.CASCADE
)
provider_id = models.SlugField(
null=False,
Expand Down
2 changes: 1 addition & 1 deletion integrated_channels/degreed/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Migration(migrations.Migration):
('key', models.CharField(help_text='The API Client ID provided to edX by the enterprise customer to be used to make API calls to Degreed on behalf of the customer.', max_length=255, verbose_name='API Client ID', blank=True)),
('secret', models.CharField(help_text='The API Client Secret provided to edX by the enterprise customer to be used to make API calls to Degreed on behalf of the customer.', max_length=255, verbose_name='API Client Secret', blank=True)),
('degreed_company_id', models.CharField(help_text='The organization code provided to the enterprise customer by Degreed.', max_length=255, verbose_name='Degreed Organization Code', blank=True)),
('enterprise_customer', models.OneToOneField(to='enterprise.EnterpriseCustomer')),
('enterprise_customer', models.OneToOneField(to='enterprise.EnterpriseCustomer', on_delete=models.CASCADE)),
],
),
migrations.CreateModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='degreedenterprisecustomerconfiguration',
name='enterprise_customer',
field=models.OneToOneField(help_text='Enterprise Customer associated with the configuration.', to='enterprise.EnterpriseCustomer'),
field=models.OneToOneField(help_text='Enterprise Customer associated with the configuration.', to='enterprise.EnterpriseCustomer', on_delete=models.CASCADE),
),
migrations.AlterField(
model_name='historicaldegreedenterprisecustomerconfiguration',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Migration(migrations.Migration):
('integrated_channel_code', models.CharField(max_length=30)),
('content_id', models.CharField(max_length=255)),
('channel_metadata', jsonfield.fields.JSONField()),
('enterprise_customer', models.ForeignKey(to='enterprise.EnterpriseCustomer')),
('enterprise_customer', models.ForeignKey(to='enterprise.EnterpriseCustomer', on_delete=models.CASCADE)),
],
),
migrations.AlterUniqueTogether(
Expand Down
3 changes: 2 additions & 1 deletion integrated_channels/integrated_channel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class EnterpriseCustomerPluginConfiguration(TimeStampedModel):
blank=False,
null=False,
help_text=_("Enterprise Customer associated with the configuration."),
on_delete=models.deletion.CASCADE
)

active = models.BooleanField(
Expand Down Expand Up @@ -247,7 +248,7 @@ class ContentMetadataItemTransmission(TimeStampedModel):
.. no_pii:
"""

enterprise_customer = models.ForeignKey(EnterpriseCustomer)
enterprise_customer = models.ForeignKey(EnterpriseCustomer, on_delete=models.CASCADE)
integrated_channel_code = models.CharField(max_length=30)
content_id = models.CharField(max_length=255)
channel_metadata = JSONField()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='sapsuccessfactorsenterprisecustomerconfiguration',
name='enterprise_customer',
field=models.OneToOneField(help_text='Enterprise Customer associated with the configuration.', to='enterprise.EnterpriseCustomer'),
field=models.OneToOneField(help_text='Enterprise Customer associated with the configuration.', to='enterprise.EnterpriseCustomer', on_delete=models.CASCADE),
),
migrations.AlterField(
model_name='sapsuccessfactorsenterprisecustomerconfiguration',
Expand Down
2 changes: 1 addition & 1 deletion integrated_channels/xapi/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Migration(migrations.Migration):
('key', models.CharField(help_text='Key of X-API LRS.', verbose_name='Client ID', max_length=255)),
('secret', models.CharField(help_text='secret of X-API LRS.', verbose_name='Client Secret', max_length=255)),
('active', models.BooleanField(help_text='Is this configuration active?')),
('enterprise_customer', models.OneToOneField(to='enterprise.EnterpriseCustomer', help_text='Enterprise Customer associated with the configuration.')),
('enterprise_customer', models.OneToOneField(to='enterprise.EnterpriseCustomer', help_text='Enterprise Customer associated with the configuration.', on_delete=models.CASCADE)),
],
),
]
1 change: 1 addition & 0 deletions integrated_channels/xapi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class XAPILRSConfiguration(TimeStampedModel):
blank=False,
null=False,
help_text=_('Enterprise Customer associated with the configuration.'),
on_delete=models.deletion.CASCADE
)
version = models.CharField(max_length=16, default='1.0.1', help_text=_('Version of xAPI.'))
endpoint = models.URLField(help_text=_('URL of the LRS.'))
Expand Down

0 comments on commit f98bcbf

Please sign in to comment.