Exemple #1
0
def init_contents(category_key, idx, addGallery):
    cm = ContentModel(visible=True, category=category_key, order=idx * 2)
    galleryHtml = '<div class="picaslide" data-picaslide-username="******" data-picaslide-albumid="LeBike">[<img alt="Insert picasa album" src="/static/img/picasa_s.png"> gallery comes here]</div>'
    desc = lambda: get_random_text(
        Random().randint(100, len(fixieText) / 2 - 40))\
        .replace('\n', '<br/>') + (galleryHtml if addGallery else '')
    tit = lambda: get_random_text(Random().randint(10, 15)).replace('\n', '')
    cm.i18n = {'en': {'title': tit(), 'description': desc()},
               'ro': {'title': tit() + ' [ro]', 'description': desc()},
               'hu': {'title': tit() + ' [hu]', 'description': desc()}}
    cm.put()
    pass
def admin_move_content(entityId):
    content = ContentModel.get_by_id(entityId)
    jsd = request_helper.get_json_data()
    content.category = CategoryModel.get_by_id(long(jsd['category_id']))
    content.put()
    return json.dumps(content.to_dict())
def admin_delete_content(entityId):
    if request.method == 'DELETE' or request.values['_method'] == 'DELETE':
        ContentModel.get_by_id(entityId).delete()
        return "{ 'value' : 'OK' }"
    pass