0

我们如何使用 auth_login 将用户重定向到基于用户角色的特定页面!

例如:

  1. 应将具有“CRM”角色的用户重定向到仪表板
  2. 应将具有“管理员”角色的用户重定向到活动

这可以使用 auth_login 在 Django 中完成吗?

4

1 回答 1

0

If by "role" you're referring to a permission, you can use has_perm() to test for the presence of a specific permission.

https://docs.djangoproject.com/en/1.4/topics/auth/#django.contrib.auth.models.User.has_perm

于 2012-05-14T14:45:20.093 回答