def save_employer(request): if not get_object_or_none(Employer, pk=request.user.pk): emp = Employer() emp.pk = request.user.pk emp.user = request.user emp.user_name = request.user.username emp.email_address = request.user.email emp.is_employer = True emp.save()
def save_employer(request): emp_id = None try: emp_id = Employer.objects.get(pk=request.user.pk) except: print('User does not exist') emp = Employer() if not emp_id: emp.pk = request.user.pk emp.user_name = request.user.username emp.email_address = request.user.email emp.is_employer = True emp.save()