text: from rest_framework import serializers
  
  from profiles_api import models
  
  
  class HelloSerializer(serializers.Serializer):
      """Serializes a name field for testing our APIViews"""
      name = serializers.CharField(max_length=10)
  
  
  class UserProfileSerializer(serializers.ModelSerializer):
      """Serializes a user profile"""
      class Meta:
          model = models.UserProfile
          # define the fields accessible in the model
          fields = ('id', 'email', 'name', 'password')
          extra_kwargs = {
              'password': {
                  'write_only': True,
                  'style': {'input_type': 'password'}
              }
          }
  
      # overwrites the default create function
      def create(self, validated_data):
          """create and return a new user"""
          user = models.UserProfile.objects.create_user(
              email=validated_data['email'],
              name=validated_data['name'],
              password=validated_data['password'],
          )
  
          return user
  
      def update(self, instance, validated_data):
          """Handle updating user account"""
          if 'password' in validated_data:
              password = validated_data.pop('password')   # remove from dict
              instance.set_password(password)  # hashes the pass. now it's safe
  
          return super().update(instance, validated_data)
  
  
  class ProfileFeedSerializer(serializers.ModelSerializer):
      """Serializes profile feed data"""
      class Meta:
          model = models.ProfileFeedItem
          fields = ('id', 'user_profile', 'status_text', 'created_on')
          extra_kwargs = {'user_profile': {'read_only':True}}
  