0

I am using pycharm and in view.py I face this issue. I don't know what type of error is this.

Here is the code

def recruiter_signup(request):
    error = ""
    if request.method == 'POST':
        f = request.POST['fname']
        l = request.POST['lname']
        con = request.POST['contact']
        e = request.POST['email']
        p = request.POST['pwd']
        gen = request.POST['gender']
        i = request.FILES['image']
        company = request.POST['company']
        try:
            user = User.objects.create_user(first_name=f, last_name=l, username=e, password=p)
            Recruiter.objects.create(user=user, mobile=con, image=i, gender=gen, company=company, type="recruiter", status="pending") #unresolved reference here
            error = "no"
        except:
            error = "yes"
    d = {'error': error}
    return render(request,'recruiter_signup.html',d)
quamrana
  • 37,849
  • 12
  • 53
  • 71
  • I can't see an unresolved reference error. How do you know about this error? – quamrana Mar 06 '22 at 15:48
  • https://stackoverflow.com/questions/21236824/unresolved-reference-issue-in-pycharm/21241988#21241988 – codester_09 Mar 06 '22 at 15:49
  • Recruiter.objects.create(user=user, mobile=con, image=i, gender=gen, company=company, type="recruiter", status="pending") #unresolved reference here – Muhammad muzammil Mar 06 '22 at 15:50
  • This isn't a Python error. It is a PyCharm warning. It is because PyCharm can't resolve the reference, which in turn is probably because it is a reference that cannot be resolved without running the code. For example it might be a dynamic import, or a function in a DLL. – BoarGules Mar 06 '22 at 16:12
  • 1
    When seeing an `unresolved reference` in PyCharm, run the code and see if any errors are reported. The code may run. If not resolve the errors. If the code runs without errors that is because of how `python` looks for modules and the code which they contain. For code which runs even though pycharm reports `unresolved reference` locate the directory which contains the code. Right click on the directory. Scroll down the context menu to `Mark Directory as` and select `Sources Root`. – Carl_M Mar 06 '22 at 19:33

0 Answers0