Re: Django session question.

2013-12-25 Thread Daniel Roseman
Did you Google "Django sessions" before posting? Or even look on the Django 
documentation index for any page entitled "sessions", such as this one:
https://docs.djangoproject.com/en/1.6/topics/http/sessions/
?
--
DR.


On Tuesday, 24 December 2013 22:30:08 UTC, Chen Xu wrote:
>
> I am working on a voting website, basically i want to be able to track the 
> votes that come from the same person, or the same session, I am wondering 
> does Django have some kinda built in session implementation that I can use 
> to track people 's actions in the same session?
>
> Thanks in advance
>
> -- 
> ⚡ Chen Xu ⚡ 
>

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/341c3120-dfe2-4d2f-8885-59f61c0caf6c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Django session question.

2013-12-24 Thread liuerfire Wang
Use the Django authentication
system,
then you can get current user with `request.user`



On Wed, Dec 25, 2013 at 6:30 AM, Chen Xu  wrote:

> I am working on a voting website, basically i want to be able to track the
> votes that come from the same person, or the same session, I am wondering
> does Django have some kinda built in session implementation that I can use
> to track people 's actions in the same session?
>
> Thanks in advance
>
> --
> ⚡ Chen Xu ⚡
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACac-qZt74Of4pO9p2sn%2Bup%3DpTNpnSK3_kx3BWkEhL890XQz3A%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Best regards.
/**
google+: +liuerfire  twitter:
@liuerfire
蛋疼不蛋疼的都可以试着点一下~^_^~ 
***/

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFysF%2BTY7e3PcLByaWwZu6KSbsseySQeb41hjQH0fsgGAOFUFw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Django session question.

2013-12-24 Thread Chen Xu
I am working on a voting website, basically i want to be able to track the
votes that come from the same person, or the same session, I am wondering
does Django have some kinda built in session implementation that I can use
to track people 's actions in the same session?

Thanks in advance

-- 
⚡ Chen Xu ⚡

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACac-qZt74Of4pO9p2sn%2Bup%3DpTNpnSK3_kx3BWkEhL890XQz3A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


session question

2009-10-26 Thread webbo

Hi all,

It's great to join this great Django place !!

I am trying to make session work, but it doesn't work as I think.

I want my 2 pages able to share the same variables that I stored in
session.

Thanks first for paying attention on this post.



Please give me some suggestion as bellow:

I want to use anonymous sessions for my 2 functions:  list_user and
list_device

1. I have a dropdown box called "group" for both functions.

2. Once I changed group value in either one page, the group value will
be stored in session.

3. For example:
If people click on group dropdown box and change value to "GROUP1"
in list_device or list_user page, then
the value of group drop-down box of both list_user and list_device
should be changed to 'GROUP1'

4. It works on Firefox if I press F5 to refresh the page.  Sometimes
the value is updated by clicking refresh button many times.  Is any
problem relate to my browser setting?

5. It never works on IE, and IE generate so many session_keys in
django_session.

#
setting.py
#

MIDDLEWARE_CLASSES = (
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', )

SESSION_ENGINE= ('django.contrib.sessions.backends.cached_db')

INSTALLED_APPS = (
#start session
'django.contrib.sessions',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',
'myTest.FrontEnd',
#admin
'django.contrib.admin',

)

#
view.py
#

def list_users(request, group_from_url ='' ):
   #Variables
   group_is_clicked = ''
   group = ''

   if (group_from_url):  #READ group from URL

 group = group_from_url
 user = user.objects.filter(group=group).distinct().order_by
('name') # generate user table
 form = userForm(initial={'group': group} )

   elif 'group' in request.session: # if group is stored in session

 group = request.session['group']
 user = user.objects.filter(group=group).distinct().order_by
('name')
 form = userForm(initial={'group': group} )

   elif group_is_clicked == 'ON':  #when user clicking on
group_dropdown_box

 group = request.POST.get('group','')
 user = user.objects.filter(group=group).distinct().order_by
('name')
 form = userForm(initial={'group': group} )

   else:# DEFAULT LOOK

  user = user.objects.all()
  form = userForm()

  #update session values
  request.session['group'] = group


  return render_to_response("User/user.html",{'group':group,
'user':user, 'form':form})


def list_device(request, group_from_url ='' ):
   #Variables
   group_is_clicked = ''
   group = ''

   if (group_from_url):  #READ group from URL

 group = group_from_url
 device = device.objects.filter(group=group).distinct().order_by
('name') # generate user table
 form = deviceForm(initial={'group': group} )

   elif 'group' in request.session: # if group is stored in session

 group = request.session['group']
 device = device.objects.filter(group=group).distinct().order_by
('name')
 form = deviceForm(initial={'group': group} )

   elif group_is_clicked == 'ON':  #when user clicking on
group_dropdown_box

 group = request.POST.get('group','')
 device = device.objects.filter(group=group).distinct().order_by
('name')
 form = deviceForm(initial={'group': group} )

   else:# DEFAULT LOOK

  device = device.objects.all()
  form = deviceForm()

  #update session values
  request.session['group'] = group


  return render_to_response("device/device.html",{'group':group,
'device':device, 'form':form})

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: session question

2007-07-18 Thread Russell Keith-Magee

On 7/18/07, james_027 <[EMAIL PROTECTED]> wrote:
>
> sorry for this stupid question ... does django's session only work
> when cookies are enabled?

Yes.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: session question

2007-07-18 Thread Malcolm Tredinnick

On Wed, 2007-07-18 at 06:51 +, james_027 wrote:
> hi,
> 
> sorry for this stupid question ... does django's session only work
> when cookies are enabled?

That is correct. See
http://www.djangoproject.com/documentation/sessions/#session-ids-in-urls
for the documentation on this.

Regards,
Malcolm

-- 
No one is listening until you make a mistake. 
http://www.pointy-stick.com/blog/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



session question

2007-07-18 Thread james_027

hi,

sorry for this stupid question ... does django's session only work
when cookies are enabled?

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---