in the models.py:
name = models.CharField(max_length=50, db_index=True)
gender = models.CharField(max_length=2, null=False, choices=GENDER_TYPE, blank=True)
in the context_helper.py:
def get_emp_info(employee):
blood_groups = blood_group_helper()
genders = gender_helper()
info = {
'ename': employee.name,
'dob': employee.dob,
'gender': [i for i in genders if employee.gender in i],
'phone': employee.phone,
'address': employee.curr_address,
'emp_id': employee.e_id,
'bgroup': [i for i in blood_groups if employee.blood_group in i],
'photo': os.path.join(settings.MEDIA_URL, employee.photo.name) if employee.photo else None,
}
return info
and the error says:
File "C:\Users\Administrator\placement\placement\helpers\context_helper.py", line 109, in get_emp_info
'ename': employee.name,
AttributeError: 'NoneType' object has no attribute 'name'
What is the problem and how to resolve in it?