Django: 设置用户个人资料页面?

16 浏览
0 Comments

Django: 设置用户个人资料页面?

我还是一个新手,不确定应该如何为用户设置个人资料页面。 django.contrib.auth.views.login 会重定向到一个 accounts/profile 页面,但我应该如何实际设置它呢?

是不是通常只需在 urls.py 中定义 accounts/profile 并将其重定向到一个模板,还是有更复杂的模式?

django.views.generic.simple.direct_to_template, {'template':'profile.html'}) 其中 profile.html 位于 PROJECT_ROOT/templates/profile.html,并扩展了 base.html

0
0 Comments

问题的出现原因是因为用户想要设置一个用户个人资料页面,但是不知道该如何实现。解决方法有两种:一种是设置一个指向accounts/profile的视图/URL,另一种是通过在settings.py中设置LOGIN_REDIRECT_URL参数来告诉Django在登录后重定向到其他页面。

0
0 Comments

问题的原因是用户需要设置一个用户个人资料页面。解决方法是使用可重复使用的应用程序来处理常见的个人资料页面功能。可以参考以下链接来查看一些可重复使用的应用程序:https://bitbucket.org/ubernostrum/django-profiles/wiki/Home 或者 http://code.google.com/p/django-profile/

0