Re: saving django session data for anonymous user

2018-06-21 Thread Melvyn Sopacua
On woensdag 13 juni 2018 14:40:05 CEST Siddharth Srivastava wrote:
> Thanks  Anthony for your prompt reply. current implementation is that i am
> using django orm query to pull the user cart details and cart id(session
> key) is the key so when user switch from anonymous
> user to actual user then i loses the data came from the query.
> 
> so when user gets authenticated then it create new session id then previous
> session data we lose. I am not finding much help in google:(.

This is a very bad design. Why don't simply store the cart ID in the session, 
rather then using a session ID for a cart's ID? This is just one of the 
problems you're going to face.
For example, implementing abandoned cart reminders is going to be no joyride 
and pretty much standard functionality in e-commerce these days. Sessions are 
there to store data and Django automatically copies the data in the session 
from anonymous user to logged in user. It's what sessions are made for.

-- 
Melvyn Sopacua

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3751359.ac4gruEBS1%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: saving django session data for anonymous user

2018-06-15 Thread 'Anthony Flury' via Django users

How are you authenticating them ?

Assuming you call :

        authenicate( username, password)

then before that call - store the sesssion key

after that call - identify the new session key

with the old and new session keys - now update the database - so that 
the cart gets associated with the new session key.



On 13/06/18 13:40, Siddharth Srivastava wrote:
Thanks  Anthony for your prompt reply. current implementation is that 
i am using django orm query to pull the user cart details and cart 
id(session key) is the key so when user switch from anonymous

user to actual user then i loses the data came from the query.

so when user gets authenticated then it create new session id then 
previous session data we lose. I am not finding much help in google:(.


Thanks,

Siddharth



On Tue, Jun 12, 2018 at 8:37 AM, Anthony Flury 
mailto:anthony.fl...@btinternet.com>> 
wrote:


The only way I can think of is when your user goes to log in -
check if their session id is already recorded.

When they login - I assume that they get an new Session Id - and
remap the data from their old session id to their new session Id.

Would that work ?

On 12/06/18 11:01, Siddharth Srivastava wrote:

Hi ,

i was writing small ecommerce application in django framework.
so i was trying to implement add to cart functionality like
that if user is anonymous user then selected products should
be mapped to it's session id which is act. cart id in models.
so the scenario is that whenever anonymous user check out and
mapped data against that session id is purged. Is there any
mechanism to save anonymous user session data even after user
logs in. kindly provide easy possible solution as i am bit new
to django:)

Thanks,

Siddharth


-- 
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 post to this group, send email to
django-users@googlegroups.com

>.
Visit this group at
https://groups.google.com/group/django-users
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com



>.
For more options, visit https://groups.google.com/d/optout
.



-- 
-- 
Anthony Flury

email : *anthony.fl...@btinternet.com
*
Twitter : *@TonyFlury >*




--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury *

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e341aaeb-62b8-9071-181c-32305a9f08cf%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


Re: saving django session data for anonymous user

2018-06-13 Thread Siddharth Srivastava
Thanks  Anthony for your prompt reply. current implementation is that i am
using django orm query to pull the user cart details and cart id(session
key) is the key so when user switch from anonymous
user to actual user then i loses the data came from the query.

so when user gets authenticated then it create new session id then previous
session data we lose. I am not finding much help in google:(.

Thanks,

Siddharth



On Tue, Jun 12, 2018 at 8:37 AM, Anthony Flury  wrote:

> The only way I can think of is when your user goes to log in - check if
> their session id is already recorded.
>
> When they login - I assume that they get an new Session Id - and remap the
> data from their old session id to their new session Id.
>
> Would that work ?
>
> On 12/06/18 11:01, Siddharth Srivastava wrote:
>
>> Hi ,
>>
>> i was writing small ecommerce application in django framework. so i was
>> trying to implement add to cart functionality like that if user is
>> anonymous user then selected products should be mapped to it's session id
>> which is act. cart id in models. so the scenario is that whenever anonymous
>> user check out and mapped data against that session id is purged. Is there
>> any mechanism to save anonymous user session data even after user logs in.
>> kindly provide easy possible solution as i am bit new to django:)
>>
>> Thanks,
>>
>> Siddharth
>>
>>
>> --
>> 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 > django-users+unsubscr...@googlegroups.com>.
>> To post to this group, send email to django-users@googlegroups.com
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com
>> > b-4d06-bfa5-af814a20cbc6%40googlegroups.com?utm_medium=email
>> _source=footer>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> --
> Anthony Flury
> email : *anthony.fl...@btinternet.com*
> Twitter : *@TonyFlury *
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAENVTMq%3DUUZ%3D_o-GVpcT8LsgeLGTYEQpa2Urjv8h97jgLONMBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: saving django session data for anonymous user

2018-06-12 Thread Melvyn Sopacua
On dinsdag 12 juni 2018 12:01:32 CEST Siddharth Srivastava wrote:

>  so the scenario is that whenever anonymous
> user check out and mapped data against that session id is purged. Is there
> any mechanism to save anonymous user session data even after user logs in.
> kindly provide easy possible solution as i am bit new to django:)


Well, the easy solution is to follow the documentation[1]:

Note that any data set during the anonymous session is retained in the
session after a user logs in.

-- 
Melvyn Sopacua


[1] 
https://docs.djangoproject.com/en/2.0/topics/auth/default/#how-to-log-a-user-in

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1614496.8M6cUJZ5yO%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Re: saving django session data for anonymous user

2018-06-12 Thread 'Anthony Flury' via Django users
The only way I can think of is when your user goes to log in - check if 
their session id is already recorded.


When they login - I assume that they get an new Session Id - and remap 
the data from their old session id to their new session Id.


Would that work ?

On 12/06/18 11:01, Siddharth Srivastava wrote:

Hi ,

i was writing small ecommerce application in django framework. so i 
was trying to implement add to cart functionality like that if user is 
anonymous user then selected products should be mapped to it's session 
id which is act. cart id in models. so the scenario is that whenever 
anonymous user check out and mapped data against that session id is 
purged. Is there any mechanism to save anonymous user session data 
even after user logs in. kindly provide easy possible solution as i am 
bit new to django:)


Thanks,

Siddharth


--
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 post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.



--
--
Anthony Flury
email : *anthony.fl...@btinternet.com*
Twitter : *@TonyFlury *

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/afd880e5-38ee-e2db-6491-b53e9c69d40f%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.


saving django session data for anonymous user

2018-06-12 Thread Siddharth Srivastava
Hi ,

i was writing small ecommerce application in django framework. so i was 
trying to implement add to cart functionality like that if user is 
anonymous user then selected products should be mapped to it's session id 
which is act. cart id in models. so the scenario is that whenever anonymous 
user check out and mapped data against that session id is purged. Is there 
any mechanism to save anonymous user session data even after user logs in. 
kindly provide easy possible solution as i am bit new to django:)

Thanks,

Siddharth

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d17bbc16-4c0b-4d06-bfa5-af814a20cbc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.