[英]Django Keep different session in different tabs
I have django app (1.6) where I want to be able open two tabs with different sessions. 我有django应用(1.6),我想在其中打开具有不同会话的两个选项卡。 But now when I open first tab with form to write a post, and on second tab I switch to different tab I also have the same session in this tab, because I refresh session.
但是现在,当我使用表单打开第一个选项卡以撰写帖子时,在第二个选项卡上,我切换到其他选项卡,在该选项卡中我也有相同的会话,因为我刷新了会话。
Is the way to separate sessions? 是分开会议的方式吗?
Thanks for any help. 谢谢你的帮助。
JS part of my code: 我的代码的JS部分:
setInterval(function () {
Dajaxice.calendars.get_calendar_name(function(data){
$('#calendars_name').html(data.calendar);
});
}, 10000);
Python part of my code: 我的代码的Python部分:
@dajaxice_register
def get_calendar_name(request):
c = request.session["current_calendar"].name
return simplejson.dumps({'calendar': c})
Instead of storing the calendar objects in session, store them in the database. 与其将日历对象存储在会话中,不如将它们存储在数据库中。 Your ajax can them request the calendar from Django by simply passing it the
id
of the calendar that you have open in that tab. 您的ajax可以通过简单地将您在该标签中打开的日历的
id
传递给Django来向Django请求日历。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.