From 4b7aa26f663dfc211c59c643e09f1c145364baba Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Fri, 14 Oct 2016 18:32:51 +0200 Subject: [PATCH] remove "homepage" transport (#13212) --- corbo/api_views.py | 6 ------ corbo/migrations/0002_auto_20150127_2221.py | 2 +- corbo/migrations/0004_auto_20160504_1744.py | 2 +- corbo/models.py | 3 +-- tests/test_api.py | 6 ++---- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/corbo/api_views.py b/corbo/api_views.py index b168e83..9a5e562 100644 --- a/corbo/api_views.py +++ b/corbo/api_views.py @@ -79,12 +79,6 @@ class SubscriptionsView(APIView): else: subcriptions.filter(identifier=identifier).delete() - if uuid: - if 'homepage' in transports: - subcriptions.get_or_create(uuid=uuid) - else: - subcriptions.filter(identifier='', uuid=uuid).delete() - def get(self, request): email = request.GET.get('email') uuid = request.GET.get('uuid') diff --git a/corbo/migrations/0002_auto_20150127_2221.py b/corbo/migrations/0002_auto_20150127_2221.py index de7a771..96c0d93 100644 --- a/corbo/migrations/0002_auto_20150127_2221.py +++ b/corbo/migrations/0002_auto_20150127_2221.py @@ -15,7 +15,7 @@ class Migration(migrations.Migration): name='Broadcast', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('channel', models.CharField(max_length=32, verbose_name='channel', choices=[(b'homepage', 'Homepage'), (b'sms', 'SMS'), (b'email', 'Email')])), + ('channel', models.CharField(max_length=32, verbose_name='channel', choices=[(b'sms', 'SMS'), (b'email', 'Email')])), ('time', models.DateTimeField(auto_now_add=True, verbose_name='sent time')), ('result', models.TextField(verbose_name='result', blank=True)), ('announce', models.ForeignKey(verbose_name='announce', to='corbo.Announce')), diff --git a/corbo/migrations/0004_auto_20160504_1744.py b/corbo/migrations/0004_auto_20160504_1744.py index 6d1d846..bf4ee79 100644 --- a/corbo/migrations/0004_auto_20160504_1744.py +++ b/corbo/migrations/0004_auto_20160504_1744.py @@ -21,7 +21,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='subscription', name='identifier', - field=models.CharField(help_text='ex.: mailto, homepage, ...', max_length=128, verbose_name='identifier', blank=True), + field=models.CharField(help_text='ex.: mailto, ...', max_length=128, verbose_name='identifier', blank=True), preserve_default=True, ), migrations.AddField( diff --git a/corbo/models.py b/corbo/models.py index 73a2862..2d31ec2 100644 --- a/corbo/models.py +++ b/corbo/models.py @@ -24,7 +24,6 @@ from ckeditor.fields import RichTextField channel_choices = ( ('mailto', _('Email')), - ('homepage', _('Homepage')) ) UNSUBSCRIBE_LINK_PLACEHOLDER = '##UNSUBSCRIBE_LINK_PLACEHOLDER##' @@ -178,7 +177,7 @@ class Subscription(models.Model): category = models.ForeignKey('Category', verbose_name=_('Category')) uuid = models.CharField(_('User identifier'), max_length=128, blank=True) identifier = models.CharField(_('identifier'), max_length=128, blank=True, - help_text=_('ex.: mailto, homepage, ...')) + help_text=_('ex.: mailto, ...')) def get_identifier_display(self): try: diff --git a/tests/test_api.py b/tests/test_api.py index bebfd9d..9b4d7b7 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -29,7 +29,7 @@ def announces(): a = Announce.objects.create(category=category, title='By email') Broadcast.objects.create(announce=a) announces.append(a) - a = Announce.objects.create(category=category, title='On homepage') + a = Announce.objects.create(category=category, title='Another one') Broadcast.objects.create(announce=a) announces.append(a) return announces @@ -44,9 +44,7 @@ def test_get_newsletters(app, categories, announces): assert 'text' in category assert category['text'] in CATEGORIES assert 'transports' in category - assert category['transports'] == [{'id': 'mailto', 'text': 'Email'}, - {'id': 'homepage', 'text': 'Homepage'} - ] + assert category['transports'] == [{'id': 'mailto', 'text': 'Email'}] def test_get_subscriptions_by_email(app, categories, announces): -- 2.9.3