当前位置: 首页>>代码示例>>Python>>正文


Python Blog.user方法代码示例

本文整理汇总了Python中models.Blog.user方法的典型用法代码示例。如果您正苦于以下问题:Python Blog.user方法的具体用法?Python Blog.user怎么用?Python Blog.user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Blog的用法示例。


在下文中一共展示了Blog.user方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: blog_add

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import user [as 别名]
def blog_add():
    user_now = current_user()
    blog = Blog(request.form)
    blog.user = user_now
    blog.save()
    log('发布成功')
    return redirect(url_for('timeline_view', username=user_now.username))
开发者ID:Maluscore,项目名称:tweet,代码行数:9,代码来源:app.py

示例2: post

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import user [as 别名]
def post(request):
    if (request.method=='POST'):
        data=JSONParser().parse(request)
        blog =  Blog()
        if(data['title'] and data['blogpost']):
            blog.title = data['title']
            blog.user = request.user
            blog.blogpost = data['blogpost']
            blog.save()
        return HttpResponseRedirect('/blog/userhome/',status=status.HTTP_200_OK)
开发者ID:vaishnavimerugu,项目名称:BlogIt,代码行数:12,代码来源:views.py

示例3: save

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import user [as 别名]
 def save(self, request):
     if not self.is_valid():
         return None
     blogid = self.cleaned_data["blogid"]
     title = self.cleaned_data["title"]
     markdown = self.cleaned_data["markdown"]
     
     if blogid:
         blog = Blog.objects.get(id=int(blogid))
     else:
         blog = Blog()
     blog.title = title
     blog.markdown = markdown
     blog.user = request.user
     blog = blog.save()
     return blog
开发者ID:yaongli,项目名称:yblog,代码行数:18,代码来源:forms.py

示例4: create_blog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import user [as 别名]
def create_blog (request):
    if request.POST:
        print request.POST
        blog = Blog()
        blog.user = request.user
        blog.title = request.POST.get('title')
        blog.description = request.POST.get('description')
##<<<<<<< HEAD
##        blog.tags = request.POST.get('blog_tags')
##=======
##        blog.tags = request.POST.get('tags')
##>>>>>>> 3eb972486d29895357819facd4a4c89bdc1b241f
        blog.save()
        return redirect_to (request, '/')
    else:
        from forms import BlogForm
        form = BlogForm
        return render(request, 'blog/blog.html', {'form':form})
开发者ID:pysecl1,项目名称:pyblog1,代码行数:20,代码来源:views.py

示例5: addblog

# 需要导入模块: from models import Blog [as 别名]
# 或者: from models.Blog import user [as 别名]
def addblog(req):
    blog = Blog()
    blog.user = req.user
    form = BlogForm(instance=blog)
    return render_to_response("post.html", {"settings": settings, "form": form}, context_instance=RequestContext(req))
开发者ID:yaongli,项目名称:yblog,代码行数:7,代码来源:views.py


注:本文中的models.Blog.user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。