<commit_before>from core.models import Application as Image
from rest_framework import serializers
from api.v2.serializers.fields.base import UUIDHyperlinkedIdentityField


class ImageSummarySerializer(serializers.HyperlinkedModelSerializer):
    user = serializers.PrimaryKeyRelatedField(
        source='created_by',
        read_only=True)
    url = UUIDHyperlinkedIdentityField(
        view_name='api:v2:application-detail',
    )
    class Meta:
        model = Image
        fields = ('id', 'url', 'uuid', 'name', 'description', 'icon',
                  'start_date', 'end_date', 'user')<commit_msg>Include 'tags' in the Image summary (returned by the /v2/instances detail API)<commit_after>from core.models import Application as Image
from rest_framework import serializers
from api.v2.serializers.fields.base import UUIDHyperlinkedIdentityField


class ImageSummarySerializer(serializers.HyperlinkedModelSerializer):
    user = serializers.PrimaryKeyRelatedField(
        source='created_by',
        read_only=True)
    tags = serializers.SerializerMethodField()

    url = UUIDHyperlinkedIdentityField(
        view_name='api:v2:application-detail',
    )

    def get_tags(self, obj):
        from api.v2.serializers.details import TagSerializer
        serializer = TagSerializer(obj.tags.all(), many=True, context=self.context)
        return serializer.data

    class Meta:
        model = Image
        fields = ('id', 'url', 'uuid', 'name', 'description', 'icon',
                  'tags', 'start_date', 'end_date', 'user')
{'fraction_non_alphanumeric': 0.10181582360570687, 'fraction_numerical': 0.0038910505836575876, 'mean_word_length': 3.747692307692308, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '113280', 'n_tokens_mistral': 434, 'n_tokens_neox': 418, 'n_words': 100}