session id attribute error

2022-09-19 Thread shiva singh
hello everyone please help me how can solve this problem:-[image: 
image.jpeg] 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f1b3116a-a14a-45fb-84d0-c4f95a05fdf0n%40googlegroups.com.


Re: session id attribute error

2022-09-19 Thread Muhammad Juwaini Abdul Rahman
That was user, so probably you need request.user.id, not session.

On Mon, 19 Sept 2022 at 16:00, shiva singh  wrote:

> hello everyone please help me how can solve this problem:-[image:
> image.jpeg]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f1b3116a-a14a-45fb-84d0-c4f95a05fdf0n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFKhtoQYy2BqXm7htomDc4nyP7RRMhtJS1NHog0JHn7yTQECGg%40mail.gmail.com.


Re: makemigrations

2022-09-19 Thread Joel Wembo
Django can't add a new field by itself without null values being allowed 
here, especially when you have unique=True set on this field. To solve that 
issue, you have to perform it in steps:

   1. Add a column with null=True or without unique=True and with some 
   default value
   2. Make sure that all records in database will have a unique value.
   3. Change the field to the final state.


On Friday, September 16, 2022 at 3:38:56 AM UTC+8 shivas...@gmail.com wrote:

> Hello I am new in Django users group. I am using Django and faching a 
> problem when i do any changes in existing models after run  makemigrations.
>
>
> This is problem :-It is impossible to add a non-nullable field 'logo' to 
> jobdetails without specifying a default. This is because the database needs 
> something to populate existing rows.
> Please select a fix:
>  1) Provide a one-off default now (will be set on all existing rows with a 
> null value for this column)
>  2) Quit and manually define a default value in models.py.
> Select an option: 2
>
>
> please help how can i solve this problem .
>
> Thank you 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9d93089a-c6ee-47a2-a925-93bb51a836fbn%40googlegroups.com.


Re: session id attribute error

2022-09-19 Thread Aashish Kumar
Do this

request.session.get(‘id’)

On Mon, 19 Sep 2022 at 1:30 PM, shiva singh  wrote:

> hello everyone please help me how can solve this problem:-[image:
> image.jpeg]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f1b3116a-a14a-45fb-84d0-c4f95a05fdf0n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACTAcrwdE7AtZR9u9YQG-3gwYedvid-33fG2JG1n2Z4eRbwbpQ%40mail.gmail.com.


Re: session id attribute error

2022-09-19 Thread Mohammad Ehsan Ansari
Hi SessionStore is a model class? if yes you can use pk instant of id


On Monday, 19 September 2022 at 22:48:02 UTC+5:30 aashishk...@gmail.com 
wrote:

> Do this 
>
> request.session.get(‘id’)
>
> On Mon, 19 Sep 2022 at 1:30 PM, shiva singh  wrote:
>
>> hello everyone please help me how can solve this problem:-[image: 
>> image.jpeg]  
>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/f1b3116a-a14a-45fb-84d0-c4f95a05fdf0n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f80105fe-94e0-4ae8-a2b4-d8173a2c608an%40googlegroups.com.


Re: DRF and React - request.user is "Anonymous user"

2022-09-19 Thread Mohammad Ehsan Ansari
make sure you have listed auth as jwt and added permission class for 
authentication 

On Monday, 12 September 2022 at 09:52:22 UTC+5:30 jacks...@gmail.com wrote:

> I have used simple JWT for authentication and i have successfully logged 
> in and am getting tokens also. But when i do a request.user in backend i 
> get "Annonymous user".
> Tried passing Authorization header in axios post in FE REACT but it throws 
> error. Am setting both refresh and access in a state variable and store it 
> in local storage . Am really new into this and I'm totally stuck here.
>
> All i did was to temporarily solve the issue is to send the user id from 
> frontend to backend and by the way it's a bad practice.
>
> So please help me out in this guys.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1f69ceeb-7294-4d51-a25c-b1a222c534d0n%40googlegroups.com.


Re: DRF and React - request.user is "Anonymous user"

2022-09-19 Thread Jackson Patrick
Do i need to pass token in headers?

On Tue, 20 Sep, 2022, 9:44 am Mohammad Ehsan Ansari, 
wrote:

> make sure you have listed auth as jwt and added permission class for
> authentication
>
> On Monday, 12 September 2022 at 09:52:22 UTC+5:30 jacks...@gmail.com
> wrote:
>
>> I have used simple JWT for authentication and i have successfully logged
>> in and am getting tokens also. But when i do a request.user in backend i
>> get "Annonymous user".
>> Tried passing Authorization header in axios post in FE REACT but it
>> throws error. Am setting both refresh and access in a state variable and
>> store it in local storage . Am really new into this and I'm totally stuck
>> here.
>>
>> All i did was to temporarily solve the issue is to send the user id from
>> frontend to backend and by the way it's a bad practice.
>>
>> So please help me out in this guys.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/1f69ceeb-7294-4d51-a25c-b1a222c534d0n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG2dbb0KZ79AbF35cuyq9Rk%2BkC1v8-YwCJeQN5xFrwvG%3DgSnNw%40mail.gmail.com.


Re: DRF and React - request.user is "Anonymous user"

2022-09-19 Thread Mohammad Ehsan Ansari
yes you need

On Tue, 20 Sept 2022 at 09:49, Jackson Patrick 
wrote:

> Do i need to pass token in headers?
>
> On Tue, 20 Sep, 2022, 9:44 am Mohammad Ehsan Ansari, 
> wrote:
>
>> make sure you have listed auth as jwt and added permission class for
>> authentication
>>
>> On Monday, 12 September 2022 at 09:52:22 UTC+5:30 jacks...@gmail.com
>> wrote:
>>
>>> I have used simple JWT for authentication and i have successfully logged
>>> in and am getting tokens also. But when i do a request.user in backend i
>>> get "Annonymous user".
>>> Tried passing Authorization header in axios post in FE REACT but it
>>> throws error. Am setting both refresh and access in a state variable and
>>> store it in local storage . Am really new into this and I'm totally stuck
>>> here.
>>>
>>> All i did was to temporarily solve the issue is to send the user id from
>>> frontend to backend and by the way it's a bad practice.
>>>
>>> So please help me out in this guys.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/1f69ceeb-7294-4d51-a25c-b1a222c534d0n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAG2dbb0KZ79AbF35cuyq9Rk%2BkC1v8-YwCJeQN5xFrwvG%3DgSnNw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF8ux6LhGJ8C3d59r%3DzV_5159hwRkZsFRjiGzU6Vq7mknjEfUg%40mail.gmail.com.


SessionStore attribute error

2022-09-19 Thread shiva singh
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: image.jpeg]

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5cbd8bee-7089-466a-8b61-7d7e3f59bb5en%40googlegroups.com.


Re: SessionStore attribute error

2022-09-19 Thread 'Kasper Laudrup' via Django users

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

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/04483ea1-1cd3-ed58-2e77-19eca96ccf40%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature