Within a view, is there an easy way to tell if this is the very first hit in a session?
I looked for something obvious like comparing session-create-date to session-last-accessed-date, but those fields don't seem to exist.
I could set a custom key in the session data, and then if the key is missing assume it's a new session, but I wondered if there were some cleaner way.
Thanks!
How about you calculate it via settings.SESSION_COOKIE_AGE
minus my_session.get_expiry_age()
. The closer to 0, the newer the session. Not sure though this is always zero for a first-hit session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With