bugfix: name clashing- importing datetime as dt

This commit is contained in:
karthik murakonda 2022-04-30 01:30:05 +05:30
parent a12b2f2a2c
commit 9b1d70ba29
1 changed files with 7 additions and 4 deletions

View File

@ -1,8 +1,11 @@
import json
from datetime import datetime
from datetime import datetime as dt
from rest_framework.decorators import api_view
from django.shortcuts import render
from django.forms.models import model_to_dict
from .serializers import *
from .utils import *
@ -72,8 +75,8 @@ def getDashboard(request, id, email, user_type):
placements = Placement.objects.filter(allowed_batch__contains=[studentDetails.batch],
allowed_branch__contains=[studentDetails.branch],
deadline_datetime__gte=datetime.now(),
offer_accepted=True, email_verified=True).order_by('deadline_datetime')
deadline_datetime__gte=dt.now(),
).order_by('deadline_datetime')
placementsdata = PlacementSerializerForStudent(placements, many=True).data
placementApplications = PlacementApplication.objects.filter(student_id=id)
@ -140,7 +143,7 @@ def submitApplication(request, id, email, user_type):
opening = get_object_or_404(Placement, id=data[OPENING_ID],
allowed_batch__contains=[student.batch],
allowed_branch__contains=[student.branch],
deadline_datetime__gte=datetime.now().date()
deadline_datetime__gte=dt.now().date()
)
if not opening.offer_accepted or not opening.email_verified:
raise PermissionError("Placement Not Approved")