Exemplo n.º 1
0
 def to_representation(self, obj):
     return {
         'id': obj.pk,
         'name': clean_html(obj.name),
         'pubDate': obj.created_at.strftime("%d.%m.%y"),
         'currency': currency_symbol(obj.currency),
         'price': obj.cost,
         'cover': obj.image.big if obj.image else '',
         'details': clean_html(obj.description) if obj.description else ''
     }
Exemplo n.º 2
0
 def to_representation(self, obj):
     return {
         'id': obj.pk,
         'name': clean_html(obj.name),
         'endDate': obj.end_coupon_date.strftime("%d.%m.%y"),
         'currency': currency_symbol(obj.currency),
         'oldPrice': obj.cost,
         'cover': obj.image.big if obj.image else '',
         'details': clean_html(obj.description) if obj.description else '',
         'percent': obj.coupon_discount_percent
     }
Exemplo n.º 3
0
    def to_representation(self, obj):
        if obj.short_description:
            short_text = obj.short_description
        else:
            short_text = Truncator(obj.description).words("30", html=True)

        return {
            'id': obj.pk,
            'name': clean_html(obj.name),
            'pubDate': obj.created_at.strftime("%d.%m.%y"),
            'currency': currency_symbol(obj.currency),
            'price': obj.cost,
            'cover': obj.image.big if obj.image else '',
            'details': clean_html(short_text) if short_text else ''
        }
Exemplo n.º 4
0
    def to_representation(self, obj):
        if obj.short_description:
            short_text = obj.short_description
        else:
            short_text = Truncator(obj.description).words("30", html=True)

        return {
            'id': obj.pk,
            'name': clean_html(obj.name),
            'endDate': obj.end_coupon_date.strftime("%d.%m.%y"),
            'currency': currency_symbol(obj.currency),
            'oldPrice': obj.cost,
            'cover': obj.image.big if obj.image else '',
            'details': clean_html(short_text) if short_text else '',
            'percent': obj.coupon_discount_percent
        }
Exemplo n.º 5
0
def getSymbol(value):
    return currency_symbol(value)
Exemplo n.º 6
0
 def get_currency(self, instance):
     return currency_symbol(instance.currency)