<commit_before>from cities_light.models import City
from rest_framework.serializers import (HyperlinkedModelSerializer,
                                        SlugRelatedField)

from persons import models


class PhysicalAddressSerializer(HyperlinkedModelSerializer):
    city = SlugRelatedField(
        slug_field='geoname_id',
        queryset=City.objects.all(),
        allow_null=True
    )

    class Meta:
        model = models.PhysicalAddress
        fields = (
            'url',
            'id',
            'street_address',
            'floor_number',
            'apartment_number',
            'city',
            'postal_code'
        )
        extra_kwargs = {
            'url': {
                'view_name': 'api:persons:physicaladdress-detail'
            },
            'city': {
                'required': False
            }
        }


class CompanySerializer(HyperlinkedModelSerializer):
<commit_msg>REF persons/serializers.py City is now an url and not an slug field.<commit_after>from cities_light.models import City
from rest_framework.serializers import (HyperlinkedModelSerializer,
                                        SlugRelatedField)

from persons import models


class PhysicalAddressSerializer(HyperlinkedModelSerializer):

    class Meta:
        model = models.PhysicalAddress
        fields = (
            'url',
            'id',
            'street_address',
            'floor_number',
            'apartment_number',
            'city',
            'postal_code'
        )
        extra_kwargs = {
            'url': {
                'view_name': 'api:persons:physicaladdress-detail'
            },
            'city': {
                'view_name': 'api:geo:city-detail',
                'lookup_field': 'geoname_id',
                'required': False,
                'allow_null': True
            }
        }


class CompanySerializer(HyperlinkedModelSerializer):

{'fraction_non_alphanumeric': 0.08645833333333333, 'fraction_numerical': 0.0, 'mean_word_length': 1.6643550624133148, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2935190', 'n_tokens_mistral': 496, 'n_tokens_neox': 468, 'n_words': 94}