<commit_before>from rest_framework import serializers
from api.models import Post, Comment, Image
from django.contrib.auth.models import User
from django.utils import timezone


class CommentSerializer(serializers.ModelSerializer):
	author = serializers.ReadOnlyField(source='author.username')
	published = serializers.ReadOnlyField(default=timezone.now)

	class Meta:
		model = Comment
		fields = ('id', 'author', 'comment', 'contentType', 'published')



class PostSerializer(serializers.ModelSerializer):
	author = serializers.ReadOnlyField(source='author.username')
	published = serializers.ReadOnlyField(default=timezone.now)
	comments = CommentSerializer(many=True, read_only=True)

	class Meta:
		model = Post
		fields = ('id', 'title', 'content', 'published', 'author', 'visibility', 'contentType', 'comments', 'image_url')


class UserSerializer(serializers.ModelSerializer):
	# posts = serializers.PrimaryKeyRelatedField(many=True, queryset=Post.objects.all())
	
	class Meta:
		model = User
		fields = ('id', 'username')
		# fields = ('id', 'username', 'posts')

class ImageSerializer(serializers.ModelSerializer):
	photo = serializers.ImageField(use_url=True)
	upload_date = serializers.ReadOnlyField(default=timezone.now)
	author = serializers.ReadOnlyField(source='author.username')

	class Meta:
		model = Image
		fields = ('photo', 'upload_date', 'author')<commit_msg>tryin t figure out seriazers.... not workin yet<commit_after>from rest_framework import serializers
from api.models import Post, Comment, Image, Author, Friend
from django.contrib.auth.models import User
from django.utils import timezone


class CommentSerializer(serializers.ModelSerializer):
	author = serializers.ReadOnlyField(source='author.username')
	published = serializers.ReadOnlyField(default=timezone.now)

	class Meta:
		model = Comment
		fields = ('id', 'author', 'comment', 'contentType', 'published')

class AuthorSerializer(serializers.ModelSerializer):
    class Meta:
        model = Author
        fields = ('github_name', 'picture', 'host')


class PostSerializer(serializers.ModelSerializer):
	author = serializers.ReadOnlyField(source='author.username')
        #github_name = serializers.PrimaryKeyRelatedField(many=False, read_only=True)
	published = serializers.ReadOnlyField(default=timezone.now)
	comments = CommentSerializer(many=True, read_only=True)

	class Meta:
		model = Post
		fields = ('id', 'title', 'content', 'published', 'author', 'visibility', 'contentType', 'comments', 'image_url')


class UserSerializer(serializers.ModelSerializer):
	# posts = serializers.PrimaryKeyRelatedField(many=True, queryset=Post.objects.all())
	
	class Meta:
		model = User
		fields = ('id', 'username')
		# fields = ('id', 'username', 'posts')

class ImageSerializer(serializers.ModelSerializer):
	photo = serializers.ImageField(use_url=True)
	upload_date = serializers.ReadOnlyField(default=timezone.now)
	author = serializers.ReadOnlyField(source='author.username')

	class Meta:
		model = Image
		fields = ('photo', 'upload_date', 'author')
{'fraction_non_alphanumeric': 0.12573867367038738, 'fraction_numerical': 0.0, 'mean_word_length': 6.359903381642512, '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': '1954707', 'n_tokens_mistral': 891, 'n_tokens_neox': 862, 'n_words': 199}