<commit_before>from django.contrib.auth.models import User, Group
from rest_framework import serializers

from valuenetwork.valueaccounting.models import *

class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ('api_url', 'username', 'email', 'groups')


class GroupSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Group
        fields = ('api_url', 'name')
        
class EconomicAgentSerializer(serializers.HyperlinkedModelSerializer):
    agent_type = serializers.RelatedField()
    projects = serializers.Field(source='contexts_participated_in')
    class Meta:
        model = EconomicAgent
        fields = ('api_url', 'url', 'name', 'nick', 'slug', 'agent_type', 'address', 'email', 'projects')
        
class ContextSerializer(serializers.HyperlinkedModelSerializer):
    agent_type = serializers.RelatedField()
    class Meta:
        model = EconomicAgent
        fields = ('api_url', 'url', 'name', 'slug', 'agent_type', 'address',)
        
        
class AgentTypeSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = AgentType
        fields = ('api_url', 'name', 'party_type', )

class PeopleSerializer(serializers.HyperlinkedModelSerializer):
    agent_type = serializers.RelatedField()
    projects = ContextSerializer(source='contexts_participated_in', many=True)
    class Meta:
        model = EconomicAgent<commit_msg>remove serializers.RelatedField() from People API to allow POSTs (Note: this is an experiment...)<commit_after>from django.contrib.auth.models import User, Group
from rest_framework import serializers

from valuenetwork.valueaccounting.models import *

class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ('api_url', 'username', 'email', 'groups')


class GroupSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Group
        fields = ('api_url', 'name')
        
class EconomicAgentSerializer(serializers.HyperlinkedModelSerializer):
    agent_type = serializers.RelatedField()
    projects = serializers.Field(source='contexts_participated_in')
    class Meta:
        model = EconomicAgent
        fields = ('api_url', 'url', 'name', 'nick', 'slug', 'agent_type', 'address', 'email', 'projects')
        
class ContextSerializer(serializers.HyperlinkedModelSerializer):
    agent_type = serializers.RelatedField()
    class Meta:
        model = EconomicAgent
        fields = ('api_url', 'url', 'name', 'slug', 'agent_type', 'address',)
        
        
class AgentTypeSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = AgentType
        fields = ('api_url', 'name', 'party_type', )

class PeopleSerializer(serializers.HyperlinkedModelSerializer):
    #agent_type = serializers.RelatedField()
    projects = ContextSerializer(source='contexts_participated_in', many=True)
    class Meta:
        model = EconomicAgent
{'fraction_non_alphanumeric': 0.10732030473666777, 'fraction_numerical': 0.0, 'mean_word_length': 4.008291873963516, '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': '4869473', 'n_tokens_mistral': 817, 'n_tokens_neox': 794, 'n_words': 187}