Category Promotion Serializer
This section outlines the serializers used in the Category Promotion API. These serializers handle the transformation of data between complex types (e.g., Django models) and Python data types (e.g., JSON), facilitating the representation of data for API requests and responses.
Serializers
- Collection Serializer:
CategoryPromotionWithCategorySerializer
1. Category Promotion Serializer
Serializer Overview
CategoryPromotionWithCategorySerializer is used to serialize category promotion data. It includes the promotion's ID, title, description, banner image, thumbnail image, start and end dates, call-to-action (CTA) URL, and the promotion's active status.
Fields
| Field | Type | Description |
|---|---|---|
id |
integer |
The unique identifier for the category promotion. |
title |
string |
The title or name of the category promotion. |
description |
string |
Description of the category promotion. |
banner_image |
string |
The URL of the banner image associated with the promotion. |
thumbnail_image |
string |
The URL of the thumbnail image representing the promotion. |
start_date |
string |
The date and time when the promotion starts. |
end_date |
string |
The date and time when the promotion ends. |
cta_url |
string |
The call-to-action URL, typically directing users to more details or to redeem the promotion. |
is_active |
boolean |
A boolean indicating whether the promotion is active. |
Example Response
{
"id": 1,
"title": "Winter Sale",
"description": "Special discounts on winter clothing.",
"banner_image": "https://example.com/media/images/winter-sale-banner.jpg",
"thumbnail_image": "https://example.com/media/images/winter-sale-thumbnail.jpg",
"start_date": "2024-11-01T00:00:00Z",
"end_date": "2024-12-01T23:59:59Z",
"cta_url": "https://example.com/promotions/winter-sale",
"is_active": true
}