                  schema=coreschema.String(
                      title="Password",
                      description="Valid password for authentication",
                  ),
              ),
          ],
          encoding="application/json",
      )
  
      def post(self, request, *args, **kwargs):
          serializer = self.serializer_class(data=request.data,
                                             context={'request': request})
          serializer.is_valid(raise_exception=True)
 
</s> remove             ),
            coreapi.Field(
                name="password",
                required=True,
                location='form',
                schema=coreschema.String(
                    title="Password",
                    description="Valid password for authentication",
 </s> add                 coreapi.Field(
                    name="password",
                    required=True,
                    location='form',
                    schema=coreschema.String(
                        title="Password",
                        description="Valid password for authentication",
                    ), </s> remove     schema = ManualSchema(
        fields=[
            coreapi.Field(
                name="username",
                required=True,
                location='form',
                schema=coreschema.String(
                    title="Username",
                    description="Valid username for authentication",
 </s> add     if coreapi is not None and coreschema is not None:
        schema = ManualSchema(
            fields=[
                coreapi.Field(
                    name="username",
                    required=True,
                    location='form',
                    schema=coreschema.String(
                        title="Username",
                        description="Valid username for authentication",
                    ), </s> remove import coreapi
 </s> add 
            ],
            encoding="application/json",
        )
                  schema=coreschema.String(
                      title="Password",
                      description="Valid password for authentication",
                  ),
            ],
            encoding="application/json",
        )
            ],
            encoding="application/json",
        )
            ],
            encoding="application/json",
        )
            ],
            encoding="application/json",
        )
  
      def post(self, request, *args, **kwargs):
          serializer = self.serializer_class(data=request.data,
                                             context={'request': request})
          serializer.is_valid(raise_exception=True)
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Import coreapi from rest_framework.compat, not directly. (#5921) 
rest_framework/authtoken/views.py