本文整理汇总了Python中project.models.Project.author方法的典型用法代码示例。如果您正苦于以下问题:Python Project.author方法的具体用法?Python Project.author怎么用?Python Project.author使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类project.models.Project
的用法示例。
在下文中一共展示了Project.author方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from project.models import Project [as 别名]
# 或者: from project.models.Project import author [as 别名]
def create(request):
if Project.objects.filter(author=request.user).filter(draft=True).count() >= 12:#cause it's funny
project=Project.objects.filter(author=request.user).filter(draft=True)[0]
else:
project = Project()
project.title = None
project.draft=True
project.author = request.user
project.save()
return(redirect('project.views.edit', project.pk))
示例2: create
# 需要导入模块: from project.models import Project [as 别名]
# 或者: from project.models.Project import author [as 别名]
def create(request):
## get the draft or draft a new empty project.
try:
project=Project.objects.filter(author=request.user).filter(draft=True)[0]
except:
project = Project()
project.title = None
project.draft=True
project.author = request.user
project.save()
return editOrCreateStuff(project, request, creating=True)