本文整理汇总了Python中forum.models.User.get_profile_url方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_profile_url方法的具体用法?Python User.get_profile_url怎么用?Python User.get_profile_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forum.models.User
的用法示例。
在下文中一共展示了User.get_profile_url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_user
# 需要导入模块: from forum.models import User [as 别名]
# 或者: from forum.models.User import get_profile_url [as 别名]
def create_user(request):
if request.POST:
form = CreateUserForm(request.POST)
if form.is_valid():
user_ = User(username=form.cleaned_data['username'], email=form.cleaned_data['email'])
user_.set_password(form.cleaned_data['password1'])
if not form.cleaned_data.get('validate_email', False):
user_.email_isvalid = True
user_.save()
UserJoinsAction(user=user_).save()
request.user.message_set.create(message=_("New user created sucessfully. %s.") % html.hyperlink(
user_.get_profile_url(), _("See %s profile") % user_.username, target="_blank"))
return HttpResponseRedirect(reverse("admin_tools", kwargs={'name': 'createuser'}))
else:
form = CreateUserForm()
return ('osqaadmin/createuser.html', {
'form': form,
})
示例2: create_user
# 需要导入模块: from forum.models import User [as 别名]
# 或者: from forum.models.User import get_profile_url [as 别名]
def create_user(request):
if request.POST:
form = CreateUserForm(request.POST)
if form.is_valid():
user_ = User(username=form.cleaned_data["username"], email=form.cleaned_data["email"])
user_.set_password(form.cleaned_data["password1"])
if not form.cleaned_data.get("validate_email", False):
user_.email_isvalid = True
user_.save()
UserJoinsAction(user=user_).save()
request.user.message_set.create(
message=_("New user created sucessfully. %s.")
% html.hyperlink(user_.get_profile_url(), _("See %s profile") % user_.username, target="_blank")
)
return HttpResponseRedirect(reverse("admin_tools", kwargs={"name": "createuser"}))
else:
form = CreateUserForm()
return ("podporaadmin/createuser.html", {"form": form})