<commit_before>from rest_framework import serializers

from .models import StockItem, StockLocation


class StockItemSerializer(serializers.ModelSerializer):
    """ Serializer for a StockItem
    """

    class Meta:
        model = StockItem
        fields = ('pk',
                  'part',
                  'location',
                  'quantity',
                  'status',
                  'updated',
                  'last_checked',
                  'review_needed',
                  'expected_arrival')


class LocationBriefSerializer(serializers.ModelSerializer):
    """ Brief information about a stock location
    """

    class Meta:
        model = StockLocation
        fields = ('pk',
                  'name',
                  'description')


class LocationDetailSerializer(serializers.ModelSerializer):
    """ Detailed information about a stock location
    """

    # List of all stock items in this location
    items = StockItemSerializer(many=True)

    # List of all child locations under this one
    children = LocationBriefSerializer(many=True)

    class Meta:
        model = StockLocation
        fields = ('pk',
                  'name',
                  'description',
                  'parent',
                  'path',
                  'children',
                  'items')<commit_msg>Fix for stock serializer<commit_after>from rest_framework import serializers

from .models import StockItem, StockLocation


class StockItemSerializer(serializers.ModelSerializer):
    """ Serializer for a StockItem
    """

    class Meta:
        model = StockItem
        fields = ('pk',
                  'part',
                  'location',
                  'quantity',
                  'status',
                  'updated',
                  'last_checked',
                  'review_needed',
                  'expected_arrival')


class LocationBriefSerializer(serializers.ModelSerializer):
    """ Brief information about a stock location
    """

    class Meta:
        model = StockLocation
        fields = ('pk',
                  'name',
                  'description')


class LocationDetailSerializer(serializers.ModelSerializer):
    """ Detailed information about a stock location
    """

    # List of all stock items in this location
    items = StockItemSerializer(many=True, read_only=True)

    # List of all child locations under this one
    children = LocationBriefSerializer(many=True, read_only=True)

    class Meta:
        model = StockLocation
        fields = ('pk',
                  'name',
                  'description',
                  'parent',
                  'path',
                  'children',
                  'items')
{'fraction_non_alphanumeric': 0.08564045773348099, 'fraction_numerical': 0.0, 'mean_word_length': 1.6725838264299804, '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': '3284475', 'n_tokens_mistral': 655, 'n_tokens_neox': 602, 'n_words': 174}