我有这个问题:新闻网站。 有两种类型的内容:免费和付费。 有三种类型的用户:用户(和访客)和订阅者。 用户可以看到免费内容。 并且可以评论内容。 客人可以看到免费内容。 并且无法对内容发表评论。 订户可以看到免费和付费内容。 并且可以评论内容。 每月订阅。
请提供出色的解决方案
I have this problem: News website. There are 2 types of content: Free and Paid. There are 3 types of users: The user (and Guest) and the Subscriber. The user can see free content. And can comment on the content. Guests can see the free content. And Can not comment on the content. The subscriber can see the free and paid content. And can comment on the content. Monthly subscription.
Please give excellent solutions.
最满意答案
首先,我建议你使用django rest_framework.it有很多很好的工具,你可以在任何你想要的平台上运行你的网站。只是一个与你的问题无关的建议。 对于你的问题你有两种方法首先使用django文件underestanding什么是权限model.with类Meta:
https://docs.djangoproject.com/en/1.10/ref/models/options/#permissions
第二,你可以使用django应用程序名称:django-guardian
请参阅doc: https : //django-guardian.readthedocs.io/en/stable/overview.html
first i recommend you to use django rest_framework.it has many good tools for that and you can run your site in anyplatform that you want.its just a advice not related to your question. for your problem you have 2 ways first use the django document for underestanding what is the permissions model.with class Meta:
https://docs.djangoproject.com/en/1.10/ref/models/options/#permissions
second you can use the django app name : django-guardian
see the doc: https://django-guardian.readthedocs.io/en/stable/overview.html
更多推荐
发布评论