Beispiel #1
0
def install():
  logging.error(">> installing post")
  params = {
    "name":"Hello world!",
    "slug":"hello-world",
    "plain_description":"Welcome to ContentQ CMS. This is your first post. Edit or delete it, then start blogging!",
    "description":"Welcome to ContentQ CMS. This is your first post. Edit or delete it, then start blogging!",
    "status":"published",
    "tags":[],
    "meta_desc":"hello world",
    "category":"uncategorized",
    "body":"<p>this is an example content</p>"
  }
  post_ref = PostItem(**params)
  post_ref.put()
  category_ref = PostCategory(name='Uncategorized', slug='uncategorized')
  category_ref.put()

  latestpost_ref = Block.add_model('latestpost', 'blog.blocks.LatestPostBlock')
  postcategories_ref = Block.add_model('postcategories', 'blog.blocks.PostCategoriesBlock')
  
  block = Block(name='Post Categories', slug='post-categories',
                position='rightsidebar', model='blog.blocks.PostCategoriesBlock',
                args={})
  block.save()
Beispiel #2
0
def page_front(request):
  area="front"
  topnews = PostItem.get_latest()
  words_num = 30
  page = "front"

  items = util.paginate(request, PostItem.get_latest())
  
  c = template.RequestContext(request, locals())
  t = loader.get_template('front.html')
  return http.HttpResponse(t.render(c))
Beispiel #3
0
def get_content():
  return {"Post Item":PostItem.all(), "Post Category":PostCategory.all()}
Beispiel #4
0
 def render(cls, context, * args, ** kwargs):
   post_list = PostItem.all()[:3]
   return cls.render_block(template_name='block_latest.html',
                           block_title=_('Latest post'),
                           context={'post_list': post_list})