from django.shortcuts import render from requests.api import request from rest_framework.views import APIView from rest_framework.response import Response from crm.models import Candidate class CorrectCandidate(APIView): authentication_classes = [] permission_classes = [] def get(self, request, *args, **kwargs): for i in Candidate.objects.all(): if i.examtest: i.examtest_date = i.examtest.start_time.date() i.save() return Response()