本文整理汇总了Python中models.Blog.created_at方法的典型用法代码示例。如果您正苦于以下问题:Python Blog.created_at方法的具体用法?Python Blog.created_at怎么用?Python Blog.created_at使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Blog
的用法示例。
在下文中一共展示了Blog.created_at方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new
# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import created_at [as 别名]
def new(request):
blog = Blog()
blog.title = 'This is a brand new blog.'
blog.content = 'lalalallalalalalala'
blog.created_at = datetime.datetime.now()
blog.save()
return HttpResponse('Save OK. <a href="/blog/view/%s/">view</a>'%blog.id)
示例2: edit_blog
# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import created_at [as 别名]
def edit_blog(request, *, name, summary, content, **kw):
print( check_admin(request))
if(not name or not name.strip()):
raise APIValueError('name','No empty name permited')
if not summary or not summary.strip():
raise APIValueError('summary','empty summary')
if not content or not content.strip():
content=' '
if request.__user__:
blog=Blog(user_id=request.__user__.id, user_name=request.__user__.name, user_image=request.__user__.image, name=name.strip(), summary=summary.strip() , content=content.strip() )
if kw['bid']:
bid=kw['bid']
print('bid='+str(bid) )
blog.id=bid
print(', blog.id='+str(blog.id))
created_at=kw['created_at']
print('created_at='+str(created_at))
blog.created_at=created_at
print(', blog.created_at='+str(created_at))
yield from blog.save()
return blog#################################################################
else:
raise APIError('sign in error','unsign in','please signin')
return None