Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add partner disablement option in discovery - EDLY-6648 #78

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion course_discovery/apps/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CurrencyAdmin(admin.ModelAdmin):
class PartnerAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': ('name', 'short_code', 'lms_url', 'lms_admin_url', 'studio_url', 'publisher_url', 'site')
'fields': ('name', 'short_code', 'lms_url', 'lms_admin_url', 'studio_url', 'publisher_url', 'site', 'is_disabled',)
}),
(_('API Configuration'), {
'description': _('Configure the APIs that will be used to retrieve data.'),
Expand Down
23 changes: 23 additions & 0 deletions course_discovery/apps/core/migrations/0019_auto_20240402_1929.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.16 on 2024-04-02 19:29

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0018_auto_20200414_0739'),
]

operations = [
migrations.AddField(
model_name='historicalpartner',
name='is_disabled',
field=models.BooleanField(default=False, verbose_name='Disable Partner'),
),
migrations.AddField(
model_name='partner',
name='is_disabled',
field=models.BooleanField(default=False, verbose_name='Disable Partner'),
),
]
1 change: 1 addition & 0 deletions course_discovery/apps/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class Partner(TimeStampedModel):
)
analytics_url = models.URLField(max_length=255, blank=True, verbose_name=_('Analytics API URL'), default='')
analytics_token = models.CharField(max_length=255, blank=True, verbose_name=_('Analytics Access Token'), default='')
is_disabled = models.BooleanField(verbose_name=_('Disable Partner'), default=False)

history = HistoricalRecords()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def handle(self, *args, **options):
signal.disconnect(receiver=api_change_receiver, sender=model)

# For each partner defined...
partners = Partner.objects.all()
partners = Partner.objects.filter(is_disabled=False)

# If a specific partner was indicated, filter down the set
partner_code = options.get('partner_code')
Expand Down