SessionStore attribute error

41 views
Skip to first unread message

shiva singh

unread,
Sep 20, 2022, 2:21:46 AM9/20/22
to Django users
hello everyone please help how can solve this problem?

this is session  code:-
 if user.password==password and user.role=="Company":
                com=Company.objects.get(user_id=user)
                request.session['id']=user.id
                request.session['role']=user.role
                request.session['company_name']=com.company_name
                request.session['email']=user.email
                return redirect('companyprofilepage')

This is my views.py code:-
def JobPostSubmit(request):
    user=UserMaster.objects.get(id=request.session.id)  
    if user.role == "Comapny":
        comp = Company.objects.get(user_id=user)        
        jobname=request.POST['jobname']
        comname=request.POST['comn']
        comemail=request.POST['come']
        comaddress=request.POST['comadd']
        comcontact=request.POST['comco']
        qualifications=request.POST['quli']
        responsblities=request.POST['resp']
        salary=request.POST['salary']
        experience=request.POST['exep']
        jobdesc=request.POST['jobdesc']
        weburl=request.POST['weburl']
        comlogo=request.FILES['comlogo']
        jps=JobDetails.objects.create(company_id=comp,jobname=jobname,company_name=comname,jobdesc=jobdesc,qulifications=qualifications,resposiilites=responsblities,location=comaddress,companywebsite=weburl,companyemail=comemail,companycontact=comcontact,salarypackage=salary,experience=experience,logo=comlogo)
        message="Job Post Successfully"
        return redirect('jobpostsubmit',{'msg':message})


image.jpeg

Kasper Laudrup

unread,
Sep 20, 2022, 2:52:12 AM9/20/22
to django...@googlegroups.com
On 20/09/2022 08.21, shiva singh wrote:
> hello everyone please help how can solve this problem?
>

I suggest you ignore all the replies you've already gotten and then post
the exact same question a third time.

Kind regards,
Kasper Laudrup
OpenPGP_0xE5D9CAC64AAA55EB.asc
OpenPGP_signature

shiva singh

unread,
Sep 20, 2022, 3:11:01 AM9/20/22
to Django users
hello Dear Kasper Laudrup
I am beginner
 sorry for this but my problem is not solve  yet  that's why  I have  sent my code for better solution of error
I am not familiar  about this file witch you are send me


Basheer Olamilekan Balogun

unread,
Sep 21, 2022, 9:32:19 PM9/21/22
to Django users
I think this best way is to check which kind of id your are store, because the primary id by default is integer
which is going to be added automatically, so in your code i can see that you specify company_id upon creation new company which i do not think 
you have such field in your JobDetail model.py,. so django will throw an error saying I do not have any place to store the id.

if that is the case, you do not need to specify id bro.

Reply all
Reply to author
Forward
0 new messages