from .models import Event, EventActivity
from employees.serializers import LocationSerializer
from rest_framework import serializers


class EventSerializer(serializers.ModelSerializer):
    location = LocationSerializer()

    class Meta(object):
        model = Event
        depth = 1
        fields = ("pk", "name", "image", "datetime", "address", "description", "is_active", "is_upcoming", "location")


class EventSimpleSerializer(serializers.Serializer):
    pk = serializers.IntegerField()
    name = serializers.CharField(max_length=100)
    image = serializers.CharField(allow_blank=True, required=False)
    datetime = serializers.DateTimeField(required=False)
    address = serializers.CharField(allow_blank=True, required=False)
    description = serializers.CharField(allow_blank=True, required=False)
    is_registered = serializers.BooleanField()


class EventActivitySerializer(serializers.ModelSerializer):
    class Meta(object):
        model = EventActivity

from .models import Event, EventActivity
from employees.serializers import LocationSerializer
from rest_framework import serializers


class EventSerializer(serializers.ModelSerializer):
    location = LocationSerializer()

    class Meta(object):
        model = Event
        depth = 1
        fields = ("pk", "name", "image", "datetime", "address", "description", "is_active", "location")


class EventSimpleSerializer(serializers.Serializer):
    pk = serializers.IntegerField()
    name = serializers.CharField(max_length=100)
    image = serializers.CharField(allow_blank=True, required=False)
    datetime = serializers.DateTimeField(required=False)
    address = serializers.CharField(allow_blank=True, required=False)
    description = serializers.CharField(allow_blank=True, required=False)
    is_registered = serializers.BooleanField()


class EventActivitySerializer(serializers.ModelSerializer):
    class Meta(object):
        model = EventActivity
        fields = ("pk", "datetime", "text", "event")

Remove is_upcoming field from Event response and Add explicit fields to EventActivity serializer
Remove is_upcoming field from Event response and Add explicit fields to EventActivity serializer

  from .models import Event, EventActivity
  from employees.serializers import LocationSerializer
  from rest_framework import serializers
  
  
  class EventSerializer(serializers.ModelSerializer):
      location = LocationSerializer()
  
      class Meta(object):
          model = Event
          depth = 1
-         fields = ("pk", "name", "image", "datetime", "address", "description", "is_active", "is_upcoming", "location")
+         fields = ("pk", "name", "image", "datetime", "address", "description", "is_active", "location")
  
  
  class EventSimpleSerializer(serializers.Serializer):
      pk = serializers.IntegerField()
      name = serializers.CharField(max_length=100)
      image = serializers.CharField(allow_blank=True, required=False)
      datetime = serializers.DateTimeField(required=False)
      address = serializers.CharField(allow_blank=True, required=False)
      description = serializers.CharField(allow_blank=True, required=False)
      is_registered = serializers.BooleanField()
  
  
  class EventActivitySerializer(serializers.ModelSerializer):
      class Meta(object):
          model = EventActivity
+         fields = ("pk", "datetime", "text", "event")
  
Remove is_upcoming field from Event response and Add explicit fields to EventActivity serializer
## Code Before:
from .models import Event, EventActivity
from employees.serializers import LocationSerializer
from rest_framework import serializers


class EventSerializer(serializers.ModelSerializer):
    location = LocationSerializer()

    class Meta(object):
        model = Event
        depth = 1
        fields = ("pk", "name", "image", "datetime", "address", "description", "is_active", "is_upcoming", "location")


class EventSimpleSerializer(serializers.Serializer):
    pk = serializers.IntegerField()
    name = serializers.CharField(max_length=100)
    image = serializers.CharField(allow_blank=True, required=False)
    datetime = serializers.DateTimeField(required=False)
    address = serializers.CharField(allow_blank=True, required=False)
    description = serializers.CharField(allow_blank=True, required=False)
    is_registered = serializers.BooleanField()


class EventActivitySerializer(serializers.ModelSerializer):
    class Meta(object):
        model = EventActivity

## Instruction:
Remove is_upcoming field from Event response and Add explicit fields to EventActivity serializer
## Code After:
from .models import Event, EventActivity
from employees.serializers import LocationSerializer
from rest_framework import serializers


class EventSerializer(serializers.ModelSerializer):
    location = LocationSerializer()

    class Meta(object):
        model = Event
        depth = 1
        fields = ("pk", "name", "image", "datetime", "address", "description", "is_active", "location")


class EventSimpleSerializer(serializers.Serializer):
    pk = serializers.IntegerField()
    name = serializers.CharField(max_length=100)
    image = serializers.CharField(allow_blank=True, required=False)
    datetime = serializers.DateTimeField(required=False)
    address = serializers.CharField(allow_blank=True, required=False)
    description = serializers.CharField(allow_blank=True, required=False)
    is_registered = serializers.BooleanField()


class EventActivitySerializer(serializers.ModelSerializer):
    class Meta(object):
        model = EventActivity
        fields = ("pk", "datetime", "text", "event")
