<commit_before>from rest_framework import viewsets, serializers
from django.forms import widgets
from realestate.listing.models import Listing


class PropertySerializer(serializers.Serializer):
    id = serializers.Field()
    title = serializers.CharField(required=False, max_length=100)
    description = serializers.CharField(widget=widgets.Textarea, max_length=1000)
    absolute_url = serializers.URLField(required=False)
    price = serializers.FloatField(required=False)
    address = serializers.CharField(required=False, max_length=255)
    type = serializers.CharField(required=False, max_length=30)
    offer = serializers.CharField(required=False, max_length=10)
    status = serializers.CharField(required=False, max_length=10)
    baths = serializers.IntegerField(required=False)
    beds = serializers.IntegerField(required=False)
    size = serializers.FloatField(required=False)
    coords = serializers.CharField(required=False, max_length=255)
    agent = serializers.CharField(required=False, max_length=100)
    created_at = serializers.CharField(required=False, max_length=100)
    last_modified = serializers.CharField(required=False, max_length=100)
    images = serializers.SerializerMethodField('get_images')

    def get_images(self, obj):
        return obj.image_list


class PropiedadViewSet(viewsets.ReadOnlyModelViewSet):
    model = Listing
    serializer_class = PropertySerializer<commit_msg>Fixed the property api endpoint to return the correct status field<commit_after>from rest_framework import viewsets, serializers
from django.forms import widgets
from realestate.listing.models import Listing


class PropertySerializer(serializers.Serializer):
    id = serializers.Field()
    title = serializers.CharField(required=False, max_length=100)
    description = serializers.CharField(widget=widgets.Textarea, max_length=1000)
    absolute_url = serializers.URLField(required=False)
    price = serializers.FloatField(required=False)
    address = serializers.CharField(required=False, max_length=255)
    type = serializers.CharField(required=False, max_length=30)
    offer = serializers.CharField(required=False, max_length=10)
    status = serializers.SerializerMethodField('get_status')
    baths = serializers.IntegerField(required=False)
    beds = serializers.IntegerField(required=False)
    size = serializers.FloatField(required=False)
    coords = serializers.CharField(required=False, max_length=255)
    agent = serializers.CharField(required=False, max_length=100)
    created_at = serializers.CharField(required=False, max_length=100)
    last_modified = serializers.CharField(required=False, max_length=100)
    images = serializers.SerializerMethodField('get_images')

    def get_images(self, obj):
        return obj.image_list

    def get_status(self, obj):
        if obj.active:
            return 'active'
        else:
            return 'inactive'


class PropiedadViewSet(viewsets.ReadOnlyModelViewSet):
    model = Listing
    serializer_class = PropertySerializer
{'fraction_non_alphanumeric': 0.08775981524249422, 'fraction_numerical': 0.017815902342461234, 'mean_word_length': 5.369747899159663, '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': '3596318', 'n_tokens_mistral': 895, 'n_tokens_neox': 852, 'n_words': 158}