fix null of detail model
This commit is contained in:
@@ -14,10 +14,12 @@ class DetailSerializer(serializers.ModelSerializer):
|
||||
exclude = ['detail_model', 'detail_text1', 'detail_text2', 'detail_text3', 'detail_text4']
|
||||
def get_texts(self, obj):
|
||||
return [
|
||||
obj.detail_text1,
|
||||
obj.detail_text2,
|
||||
obj.detail_text3,
|
||||
obj.detail_text4
|
||||
text for text in [
|
||||
obj.detail_text1,
|
||||
obj.detail_text2,
|
||||
obj.detail_text3,
|
||||
obj.detail_text4,
|
||||
] if text
|
||||
]
|
||||
|
||||
class ProductDetailSerializer(serializers.ModelSerializer):
|
||||
|
||||
Reference in New Issue
Block a user