from rest_framework import serializers

# Other AstroBin apps
from common.api_fields import PKRelatedFieldAcceptNull

# This app
from .models import NestedComment


class NestedCommentSerializer(serializers.ModelSerializer):
    class Meta:
        model = NestedComment
        fields = (
            'id',
            'author',
            'content_type',
            'object_id',
            'text',
            'created',
            'updated',
            'deleted',
            'parent',
        )

    parent = PKRelatedFieldAcceptNull(read_only = True)

from rest_framework import serializers

# Other AstroBin apps
from common.api_fields import PKRelatedFieldAcceptNull

# This app
from .models import NestedComment


class NestedCommentSerializer(serializers.ModelSerializer):
    class Meta:
        model = NestedComment
        fields = (
            'id',
            'author',
            'content_type',
            'object_id',
            'text',
            'created',
            'updated',
            'deleted',
            'parent',
        )

Remove unneded API serializer field that was breaking nested comments
Remove unneded API serializer field that was breaking nested comments

  from rest_framework import serializers
  
  # Other AstroBin apps
  from common.api_fields import PKRelatedFieldAcceptNull
  
  # This app
  from .models import NestedComment
  
  
  class NestedCommentSerializer(serializers.ModelSerializer):
      class Meta:
          model = NestedComment
          fields = (
              'id',
              'author',
              'content_type',
              'object_id',
              'text',
              'created',
              'updated',
              'deleted',
              'parent',
          )
  
-     parent = PKRelatedFieldAcceptNull(read_only = True)
- 
Remove unneded API serializer field that was breaking nested comments
## Code Before:
from rest_framework import serializers

# Other AstroBin apps
from common.api_fields import PKRelatedFieldAcceptNull

# This app
from .models import NestedComment


class NestedCommentSerializer(serializers.ModelSerializer):
    class Meta:
        model = NestedComment
        fields = (
            'id',
            'author',
            'content_type',
            'object_id',
            'text',
            'created',
            'updated',
            'deleted',
            'parent',
        )

    parent = PKRelatedFieldAcceptNull(read_only = True)

## Instruction:
Remove unneded API serializer field that was breaking nested comments
## Code After:
from rest_framework import serializers

# Other AstroBin apps
from common.api_fields import PKRelatedFieldAcceptNull

# This app
from .models import NestedComment


class NestedCommentSerializer(serializers.ModelSerializer):
    class Meta:
        model = NestedComment
        fields = (
            'id',
            'author',
            'content_type',
            'object_id',
            'text',
            'created',
            'updated',
            'deleted',
            'parent',
        )
