def create(self, validated_data):
# print(validated_data)
tags = validated_data.pop("tags")
language = validated_data.pop("language")
snip = Snip(**validated_data)
# languageObj, created = Language.objects.get_or_create(**language)
snip.language = language
snip.save()
for tag in tags:
# tagObj, created = Tag.objects.get_or_create(**tag)
# print(tagObj)
snip.tags.add(tag)
return ShallowSnipSerializer(snip).data
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter