color dan deskripsi konten
This commit is contained in:
parent
3599d6d7fb
commit
11ca62eee4
@ -30,6 +30,8 @@ class ContentTheme(SoftDeleteModel):
|
|||||||
validators=[validate_image_size, validate_image_ext, validate_image],
|
validators=[validate_image_size, validate_image_ext, validate_image],
|
||||||
null=False, blank=False)
|
null=False, blank=False)
|
||||||
|
|
||||||
|
color = models.CharField(max_length=7, null=True, blank=True)
|
||||||
|
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
@ -84,6 +86,7 @@ class Content(SoftDeleteModel):
|
|||||||
topic = models.ForeignKey(ContentTopic, on_delete=models.CASCADE, null=False)
|
topic = models.ForeignKey(ContentTopic, on_delete=models.CASCADE, null=False)
|
||||||
format = models.CharField(max_length=25, choices=CONTENT_FORMAT_CHOICES)
|
format = models.CharField(max_length=25, choices=CONTENT_FORMAT_CHOICES)
|
||||||
|
|
||||||
|
description = models.CharField(max_length=255, null=True, blank=True)
|
||||||
content = models.TextField(null=True)
|
content = models.TextField(null=True)
|
||||||
data = models.JSONField(null=True)
|
data = models.JSONField(null=True)
|
||||||
|
|
||||||
@ -92,6 +95,8 @@ class Content(SoftDeleteModel):
|
|||||||
point = models.IntegerField()
|
point = models.IntegerField()
|
||||||
coin = models.IntegerField()
|
coin = models.IntegerField()
|
||||||
|
|
||||||
|
color = models.CharField(max_length=7, null=True, blank=True)
|
||||||
|
|
||||||
created_at = models.DateTimeField(auto_now_add=True)
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
updated_at = models.DateTimeField(auto_now=True)
|
updated_at = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ class ContentThemeSerializer(serializers.ModelSerializer):
|
|||||||
featured_image = ImageField(max_length=255, allow_empty_file=False)
|
featured_image = ImageField(max_length=255, allow_empty_file=False)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.ContentTheme
|
model = models.ContentTheme
|
||||||
fields = ['id', 'theme', 'description', 'featured_image']
|
fields = ['id', 'theme', 'description', 'featured_image', 'color']
|
||||||
|
|
||||||
class ContentTopicSerializer(serializers.ModelSerializer):
|
class ContentTopicSerializer(serializers.ModelSerializer):
|
||||||
featured_image = ImageField(max_length=255, allow_empty_file=False)
|
featured_image = ImageField(max_length=255, allow_empty_file=False)
|
||||||
@ -28,7 +28,7 @@ class ContentSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Content
|
model = models.Content
|
||||||
fields = ['id', 'title', 'slug', 'featured_image', 'theme', 'topic', 'format', 'content', 'point', 'coin', 'data', 'grades']
|
fields = ['id', 'title', 'slug', 'featured_image', 'theme', 'topic', 'format', 'description','content', 'point', 'coin', 'data', 'grades', 'color']
|
||||||
|
|
||||||
class ContentDetailSerializer(serializers.ModelSerializer):
|
class ContentDetailSerializer(serializers.ModelSerializer):
|
||||||
theme = ContentThemeSerializer(read_only=True)
|
theme = ContentThemeSerializer(read_only=True)
|
||||||
@ -37,4 +37,4 @@ class ContentDetailSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Content
|
model = models.Content
|
||||||
fields = ['id', 'title', 'slug', 'featured_image', 'theme', 'topic', 'format', 'content', 'point', 'coin', 'data', 'grades']
|
fields = ['id', 'title', 'slug', 'featured_image', 'theme', 'topic', 'format', 'description','content', 'point', 'coin', 'data', 'grades', 'color']
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user