如何为匿名用户创建类似 Django 的按钮? [英] How to create Django like button for anonymous users?

查看:22
本文介绍了如何为匿名用户创建类似 Django 的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Django,我的网站没有用户个人资料,所以都是匿名的.我想实现一个喜欢"系统.如何限制用户只喜欢一次.谢谢.

I am using Django and my website has no user profiles so all are anonymous. I want to implement a 'like' system. How do I restrict a user to like only once. Thanks.

推荐答案

如果您没有任何方法来识别您的用户,那么最好的办法是将此信息存储在浏览器 cookieHTML5 本地存储.(我不建议使用 flash cookie,因为关于它们的争论很长,而且它们更难实施)

If you don't have any way of identifying your users then your best bet is to store this info in a browser cookie or HTML5 local storage. (I don't advise using flash cookies since there is a long debate about them and they are harder to implement)

这篇关于如何为匿名用户创建类似 Django 的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆