2011-10-17 67 views
6

我正在设置一个新的django项目,我想使用提供的应用程序django-registration和django配置文件。我安装了它们两个,安装简单,并设法让django注册工作正常。我的下一步是将django-profile应用程序连接到工作分支。 django注册提供了一个服务,该服务重定向到一个URL,该URL在settings.py变量LOGIN_REDIRECT_URL中定义。我的猜测是,我可以简单地粘贴django-profile应用程序的URL来连接两者。 (例如'/ profiles /')。 我的settings.py变量AUTH_PROFILE_MODULE在'registration.User'上设置,(尝试使用django-registration模型!)。 但我得到一个 SiteProfileNotAvailable在/ profiles/ 没有例外提供 错误。 我试图按照下列步骤操作: https://bitbucket.org/ubernostrum/django-registration/src/tip/docs/index.rst https://bitbucket.org/ubernostrum/django-profiles/src/tip/docs/overview.txt 但我不知道,如果我所做的一切都是正确的,从OVERVIEW.TXT获取django注册和django配置文件一起工作

即本款默认使用,为您的网站的个人资料和模型正确指定 AUTH_PROFILE_MODULE设置。然后将profiles 添加到您的INSTALLED_APPS设置中,创建相应的模板 并设置网址。为了方便链接到配置文件,您的 配置文件模型应定义一个get_absolute_url()方法,其中 路由到视图profiles.views.profile_detail,传递 用户名。

所以我的问题是:

  • 那是一个众所周知的错误?
  • 将'registration.User'设置为AUTH_PROFILE_MODULE是否正确?
  • 什么是“应该定义一个get_absolute_url()方法,其中 路由到视图profiles.views.profile_detail,通过 用户名。”在overview.txt中?

回答

3

由于文档类型和缺少模板,django注册很难使用。许多Django开发现在使用Django的社会身份验证改为:

https://github.com/omab/django-social-auth http://django-social-auth.readthedocs.org/en/latest/index.html

你可以看到肯尼斯·爱如何整合入Django的包代码库的位置:

https://github.com/opencomparison/opencomparison/blob/master/apps/profiles/views.py#L83 https://github.com/opencomparison/opencomparison/blob/master/settings.py#L277