class AppUserSerializer(serializers.ModelSerializer):
    username = serializers.CharField(source='user.username')
email = serializers.CharField(source='user.email')
password = serializers.CharField(source='user.password')
ban_status = serializers.Field(source='ban_status')


class Meta:
    model = AppUser
fields = 'id', 'username', 'email', 'password', 'ban_status'

def restore_object(self, attrs, instance=None):
    """
        Given a dictionary of deserialized field values, either update
        an existing model instance, or create a new model instance.
        """
if instance is not None:
    instance.user.email = attrs.get('user.email', instance.user.email)
instance.ban_status = attrs.get('ban_status', instance.ban_status)
instance.user.password = attrs.get('user.password', instance.user.password)
return instance
user = User.objects.create_user(username=attrs.get('user.username'), email=
    attrs.get('user.email'), password=attrs.get('user.password'))
return AppUser(user=user)
Django REST Framework Создание пользовательского пользователя