Merge branch 'feature/carousel_international_news' into 'develop'
feature/carousel_international_news See merge request gm/gm-backend!79
This commit is contained in:
commit
f0ed1c0a8c
18
apps/main/migrations/0045_carousel_is_international.py
Normal file
18
apps/main/migrations/0045_carousel_is_international.py
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 2.2.7 on 2019-12-23 14:34
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0044_auto_20191217_1125'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='carousel',
|
||||||
|
name='is_international',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='is international'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -214,6 +214,9 @@ class CarouselQuerySet(models.QuerySet):
|
||||||
"""Filter collection by country code."""
|
"""Filter collection by country code."""
|
||||||
return self.filter(country__code=code)
|
return self.filter(country__code=code)
|
||||||
|
|
||||||
|
def get_international(self):
|
||||||
|
return self.filter(is_international=True)
|
||||||
|
|
||||||
|
|
||||||
class Carousel(models.Model):
|
class Carousel(models.Model):
|
||||||
"""Carousel model."""
|
"""Carousel model."""
|
||||||
|
|
@ -221,6 +224,7 @@ class Carousel(models.Model):
|
||||||
object_id = models.PositiveIntegerField(blank=True, null=True, default=None)
|
object_id = models.PositiveIntegerField(blank=True, null=True, default=None)
|
||||||
content_object = generic.GenericForeignKey('content_type', 'object_id')
|
content_object = generic.GenericForeignKey('content_type', 'object_id')
|
||||||
|
|
||||||
|
is_international = models.BooleanField(default=False, verbose_name=_('is international'))
|
||||||
old_id = models.PositiveIntegerField(_('old id'), blank=True, null=True, default=None)
|
old_id = models.PositiveIntegerField(_('old id'), blank=True, null=True, default=None)
|
||||||
title = models.CharField(_('old title'), max_length=255, blank=True, null=True, default=None)
|
title = models.CharField(_('old title'), max_length=255, blank=True, null=True, default=None)
|
||||||
link = models.CharField(_('old link'), max_length=255, blank=True, null=True, default=None)
|
link = models.CharField(_('old link'), max_length=255, blank=True, null=True, default=None)
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,13 @@ from django.utils.translation import ugettext_lazy as _
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from notification import models
|
from notification import models
|
||||||
from utils.methods import get_user_ip
|
from utils.methods import get_user_ip
|
||||||
|
from utils.serializers import TranslatedField
|
||||||
|
|
||||||
|
|
||||||
class SubscriptionTypeSerializer(serializers.ModelSerializer):
|
class SubscriptionTypeSerializer(serializers.ModelSerializer):
|
||||||
"""Subscription type serializer."""
|
"""Subscription type serializer."""
|
||||||
|
|
||||||
|
name_translated = TranslatedField()
|
||||||
class Meta:
|
class Meta:
|
||||||
"""Meta class."""
|
"""Meta class."""
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user