本文整理汇总了Python中projects.models.Participation.organizing方法的典型用法代码示例。如果您正苦于以下问题:Python Participation.organizing方法的具体用法?Python Participation.organizing怎么用?Python Participation.organizing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类projects.models.Participation
的用法示例。
在下文中一共展示了Participation.organizing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit_participants_make_organizer
# 需要导入模块: from projects.models import Participation [as 别名]
# 或者: from projects.models.Participation import organizing [as 别名]
def edit_participants_make_organizer(request, slug, username):
participation = get_object_or_404(Participation, project__slug=slug, user__username=username, left_on__isnull=True)
if participation.organizing or request.method != "POST":
return http.HttpResponseForbidden(_("You can't make that person an organizer"))
participation.left_on = datetime.datetime.now()
participation.save()
participation = Participation(user=participation.user, project=participation.project)
participation.organizing = True
participation.save()
messages.success(request, _("The participant is now an organizer."))
return http.HttpResponseRedirect(
reverse("projects_edit_participants", kwargs=dict(slug=participation.project.slug))
)