From ce9aa300749e63fd1fc04665b085f31b2d741e00 Mon Sep 17 00:00:00 2001 From: Kuroshini Date: Wed, 5 Feb 2020 16:12:28 +0300 Subject: [PATCH] change news states --- apps/account/tasks.py | 1 - .../news/migrations/0056_auto_20200205_1310.py | 18 ++++++++++++++++++ apps/news/models.py | 8 ++------ apps/transfer/serializers/news.py | 6 +++--- 4 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 apps/news/migrations/0056_auto_20200205_1310.py diff --git a/apps/account/tasks.py b/apps/account/tasks.py index 86ec63f3..cf1ded9f 100644 --- a/apps/account/tasks.py +++ b/apps/account/tasks.py @@ -69,7 +69,6 @@ def send_team_invite_to_existing_user(user_id, country_code, user_role_id, resta f'DETAIL: Exception occurred for user: {user_id}') - @shared_task def team_role_revoked(user_id, country_code, restaurant_name): """Send email to establishment team member with role acceptance link""" diff --git a/apps/news/migrations/0056_auto_20200205_1310.py b/apps/news/migrations/0056_auto_20200205_1310.py new file mode 100644 index 00000000..cfb7db3b --- /dev/null +++ b/apps/news/migrations/0056_auto_20200205_1310.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.7 on 2020-02-05 13:10 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('news', '0055_auto_20200131_1232'), + ] + + operations = [ + migrations.AlterField( + model_name='news', + name='state', + field=models.PositiveSmallIntegerField(choices=[(0, 'published'), (1, 'not published')], default=1, verbose_name='State'), + ), + ] diff --git a/apps/news/models.py b/apps/news/models.py index 34328a05..dc01b88c 100644 --- a/apps/news/models.py +++ b/apps/news/models.py @@ -278,16 +278,12 @@ class News(GalleryMixin, BaseAttributes, TranslatedFieldsMixin, HasTagsMixin, ) # STATE CHOICES - REMOVE = 0 - HIDDEN = 1 - PUBLISHED = 2 - UNPUBLISHED = 3 + PUBLISHED = 0 + UNPUBLISHED = 1 PUBLISHED_STATES = [PUBLISHED] STATE_CHOICES = ( - (REMOVE, _('remove')), # simply stored in DB news. not shown anywhere - (HIDDEN, _('hidden')), # not shown in api/web or api/mobile (PUBLISHED, _('published')), # shown everywhere (UNPUBLISHED, _('not published')), # newly created news ) diff --git a/apps/transfer/serializers/news.py b/apps/transfer/serializers/news.py index 81bf69a2..d290b8bb 100644 --- a/apps/transfer/serializers/news.py +++ b/apps/transfer/serializers/news.py @@ -92,9 +92,9 @@ class NewsSerializer(serializers.Serializer): states = { 'new': News.UNPUBLISHED, 'published': News.PUBLISHED, - 'hidden': News.HIDDEN, - 'published_exclusive': News.PUBLISHED, - 'scheduled_exclusively': News.PUBLISHED, + 'hidden': News.UNPUBLISHED, + 'published_exclusive': News.UNPUBLISHED, + 'scheduled_exclusively': News.UNPUBLISHED, } return states.get(data['page__state'], News.UNPUBLISHED)