Merge pull request #187 from CDC-IITDH/fixing-inf
fixed inf validation and logs every inf and jnf request
This commit is contained in:
commit
f6d27a9e5a
|
@ -17,6 +17,8 @@ logger = logging.getLogger('db')
|
||||||
RECAPTCHA_VALUE, JOB_LOCATION
|
RECAPTCHA_VALUE, JOB_LOCATION
|
||||||
])
|
])
|
||||||
def addPlacement(request):
|
def addPlacement(request):
|
||||||
|
logger.info("JNF filled by " + str(request.data['email']))
|
||||||
|
logger.info(json.dumps(request.data))
|
||||||
try:
|
try:
|
||||||
data = request.data
|
data = request.data
|
||||||
files = request.FILES
|
files = request.FILES
|
||||||
|
@ -353,6 +355,7 @@ def autoFillInf(request):
|
||||||
CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, RECAPTCHA_VALUE])
|
CONTACT_PERSON_NAME, PHONE_NUMBER, EMAIL, RECAPTCHA_VALUE])
|
||||||
def addInternship(request):
|
def addInternship(request):
|
||||||
logger.info("INF filled by " + str(request.data['email']))
|
logger.info("INF filled by " + str(request.data['email']))
|
||||||
|
logger.info(json.dumps(request.data))
|
||||||
try:
|
try:
|
||||||
data = request.data
|
data = request.data
|
||||||
files = request.FILES
|
files = request.FILES
|
||||||
|
@ -416,12 +419,12 @@ def addInternship(request):
|
||||||
else:
|
else:
|
||||||
internship.is_work_from_home = False
|
internship.is_work_from_home = False
|
||||||
|
|
||||||
if data[ALLOWED_BATCH] is None or json.loads(data[ALLOWED_BATCH]) == "":
|
if ALLOWED_BATCH in data[ALLOWED_BATCH] and data[ALLOWED_BATCH] is None or json.loads(data[ALLOWED_BATCH]) == "":
|
||||||
raise ValueError('Allowed Branch cannot be empty')
|
raise ValueError('Allowed Batches cannot be empty')
|
||||||
elif set(json.loads(data[ALLOWED_BATCH])).issubset(BATCHES):
|
elif ALLOWED_BATCH in data[ALLOWED_BATCH] and set(json.loads(data[ALLOWED_BATCH])).issubset(BATCHES):
|
||||||
internship.allowed_batch = json.loads(data[ALLOWED_BATCH])
|
internship.allowed_batch = json.loads(data[ALLOWED_BATCH])
|
||||||
else:
|
else:
|
||||||
raise ValueError('Allowed Batch must be a subset of ' + str(BATCHES))
|
internship.allowed_batch = ['2021']
|
||||||
|
|
||||||
if data[ALLOWED_BRANCH] is None or json.loads(data[ALLOWED_BRANCH]) == "":
|
if data[ALLOWED_BRANCH] is None or json.loads(data[ALLOWED_BRANCH]) == "":
|
||||||
raise ValueError('Allowed Branch cannot be empty')
|
raise ValueError('Allowed Branch cannot be empty')
|
||||||
|
|
Loading…
Reference in New Issue