<commit_before>from rest_framework import serializers, viewsets, status, generics
from models import Record, Style
from rest_framework.response import Response
import base64
from django.core.files.base import ContentFile
import md5
import base64
from django.views.decorators.csrf import csrf_exempt
import os

# Style Serializer
class StyleSerializer(serializers.ModelSerializer):
    raw_content = serializers.SerializerMethodField(read_only=True)
    content = serializers.CharField(write_only=True,allow_null=True)
    name = serializers.CharField(default='builtin')
    class Meta:
        model = Style
        fields = (
            'name',
            'format',
            'default',
            'content',
            'raw_content'
        )
    def get_raw_content(self, obj):
        if obj.content:
            return obj.content.read().encode('base64')
        else:
            return None

# Record Serializer
class RecordSerializer(serializers.ModelSerializer):
    styles = StyleSerializer(many=True,required=False)
    workspace =  serializers.CharField(max_length=255, write_only=True)
    name = serializers.CharField(max_length=255, write_only=True)
    class Meta:
        model = Record
        fields = (
            'title',
            'insert_date',
            'any_text',
            'modified',
            'abstract',
            'keywords',<commit_msg>added identifier to the record serializer<commit_after>from rest_framework import serializers, viewsets, status, generics
from models import Record, Style
from rest_framework.response import Response
import base64
from django.core.files.base import ContentFile
import md5
import base64
from django.views.decorators.csrf import csrf_exempt
import os

# Style Serializer
class StyleSerializer(serializers.ModelSerializer):
    raw_content = serializers.SerializerMethodField(read_only=True)
    content = serializers.CharField(write_only=True,allow_null=True)
    name = serializers.CharField(default='builtin')
    class Meta:
        model = Style
        fields = (
            'name',
            'format',
            'default',
            'content',
            'raw_content'
        )
    def get_raw_content(self, obj):
        if obj.content:
            return obj.content.read().encode('base64')
        else:
            return None

# Record Serializer
class RecordSerializer(serializers.ModelSerializer):
    styles = StyleSerializer(many=True,required=False)
    workspace =  serializers.CharField(max_length=255, write_only=True)
    name = serializers.CharField(max_length=255, write_only=True)
    class Meta:
        model = Record
        fields = (
            'identifier',
            'title',
            'insert_date',
            'any_text',
            'modified',
            'abstract',
            'keywords',
{'fraction_non_alphanumeric': 0.08610914245216159, 'fraction_numerical': 0.009213323883770375, 'mean_word_length': 2.7390728476821193, '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': '5168739', 'n_tokens_mistral': 764, 'n_tokens_neox': 757, 'n_words': 175}