django - providing a profile for anonymous user -


i creating django app users answer different questions in survey, if have not logged in, votes removed after 3 days.

the way @ moment follows:

once anonymous user tries answer question, create new user, log them in , assign answers. once user wants create account, i'll have them change details.

the annoying side effect of approach is: when clandestinely create account anonymous user allow voting, have pretend towards user not logged in. annoying using standard admin views , templates in general have check additional property, tells me if have automatically created user or if user did it.

is there better way?

a simpler solution not tying survey answers user id. give survey response separate, independent id. when real user logged in, create one-sided association user survey response. when anonymous user registers, add association well. (that is, "owner" of survey optional.) afterwards, periodically delete old survey responses have no owner, and/or ignore outdated ones in queries.

this shifts of complexity admin app user registration only. (i.e. when anonymous user answers survey, store response id in session. when new user registers, check session response ids, , then assign user id.)


Comments