def create(self, request): """ Creates a new blogpost. """ attrs = self.flatten_dict(request.POST) print "CREATE ", attrs, request.user if self.exists(**attrs): return rc.DUPLICATE_ENTRY else: post = Blogpost(title=attrs['title'], content=attrs['content'], author=request.user) post.save() return post
def create(self, request): """ Creates a new blogpost. """ attrs = self.flatten_dict(request.POST) if self.exists(**attrs): return rc.DUPLICATE_ENTRY else: post = Blogpost(title=attrs["title"], content=attrs["content"], author=request.user) post.save() return post