tried to look into the docs but couldn't find a reason.
you can go through this page to find out any possible reason
https://docs.djangoproject.com/en/dev/topics/http/sessions/

On Fri, 3 Dec 2021 at 23:19, kayhan <kayhank...@gmail.com> wrote:

> Thanks but I did not change the settings.
> And to test, SESSION_COOKIE_AGE = 5 * 60,
>   I added to the settings but there is still the same problem.
>
> On Fri, Dec 3, 2021 at 8:55 PM Lalit Suthar <sutharlalit...@gmail.com>
> wrote:
>
>> We can save that in any django model in ajax() request if possible.
>>
>> You can check if you have modified `SESSION_COOKIE_AGE` (
>> https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SESSION_COOKIE_AGE
>> )
>> if it is too less that might be the reason.
>>
>> On Fri, 3 Dec 2021 at 16:15, kayhan <kayhank...@gmail.com> wrote:
>>
>>> Hi
>>> I first send a request to Django and save its data with a session.
>>> I will send another request to Django later. Here I want to use the data
>>> of the previous request.
>>> But my code does not work properly. And the value "None" appears in the
>>> output.
>>> Does anyone know what I should do?
>>> Thankful
>>>
>>> def planing(request): if request.is_ajax(): # Get user location from
>>> user location.js file: latitude = request.POST.get('latitude', None)
>>> longitude = request.POST.get('longitude', None) print("latitude,
>>> longitude = ", latitude,longitude) # To save data request.session[
>>> 'latitude'] = latitude request.session['longitude'] = longitude # To
>>> retrive data: latitude = request.session.get('latitude') longitude =
>>> request.session.get('longitude') print("latitude, longitude = ",
>>> latitude,longitude) elif request.method == "GET": return
>>> render(request, "tourist/planing.html") elif request.method == "POST": #
>>> To retrive data: latitude = request.session.get('latitude') longitude =
>>> request.session.get('longitude') print("latitude, longitude = ",
>>> latitude,longitude) Output: latitude, longitude = 34.801595 48.499574
>>> latitude, longitude = 34.801595 48.499574 latitude, longitude = None
>>> None
>>>
>>> --
>>> 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/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/4bef9d07-cd92-440a-8ec0-dd4c206e6ae7n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAGp2JVEkLiwVEAF3uV%3DBBOQJuUwVBaQGhD7RA7t0aDirh%2BD-ZQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CAO-vjETOG1Nq%3D_Evk7ryvr27eBxtDSQfiygKV%3Djq9TTzkiuPTw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAO-vjETOG1Nq%3D_Evk7ryvr27eBxtDSQfiygKV%3Djq9TTzkiuPTw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAGp2JVE1byyT%2BO8Rxx%2BuGh49ouxvMs8MLmHHWzL-1c_WR8ssnw%40mail.gmail.com.

Reply via email to