<commit_before>from rest_framework import serializers

from popolo import models as popolo_models
from parties.serializers import MinimalPartySerializer


class MinimalPostSerializer(serializers.ModelSerializer):
    class Meta:
        model = popolo_models.Post
        fields = ("id", "label", "slug")

    id = serializers.ReadOnlyField(source="slug")
    label = serializers.ReadOnlyField()


class NominationAndResultSerializer(serializers.HyperlinkedModelSerializer):
    """
    A representation of a Membership with only the information on the ballot
    paper, and results if we have them.

    """

    class Meta:
        model = popolo_models.Membership
        fields = ("elected", "party_list_position", "person", "party")

    elected = serializers.ReadOnlyField()
    party_list_position = serializers.ReadOnlyField()
    person = serializers.ReadOnlyField(source="person.name")
    party = MinimalPartySerializer(read_only=True)<commit_msg>Remove membership internal ID and change person to name<commit_after>from rest_framework import serializers

from popolo import models as popolo_models
from parties.serializers import MinimalPartySerializer


class MinimalPostSerializer(serializers.ModelSerializer):
    class Meta:
        model = popolo_models.Post
        fields = ("id", "label", "slug")

    id = serializers.ReadOnlyField(source="slug")
    label = serializers.ReadOnlyField()


class NominationAndResultSerializer(serializers.HyperlinkedModelSerializer):
    """
    A representation of a Membership with only the information on the ballot
    paper, and results if we have them.

    """

    class Meta:
        model = popolo_models.Membership
        fields = ("id", "elected", "party_list_position", "name", "party")

    elected = serializers.ReadOnlyField()
    party_list_position = serializers.ReadOnlyField()
    name = serializers.ReadOnlyField(source="person.name")
    party = MinimalPartySerializer(read_only=True)
{'fraction_non_alphanumeric': 0.08520408163265306, 'fraction_numerical': 0.0, 'mean_word_length': 4.35792349726776, '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': '4764213', 'n_tokens_mistral': 522, 'n_tokens_neox': 512, 'n_words': 140}