Пример #1
0
 def set_title(self):
     """ Create id from Meta Title if `new` is found in current
         URL, 'admin/blog/new' for example.
     """
     path = self['id'].split('/')
     for key, s in enumerate(path):
         if s == 'new':
             path[key] = s.replace('new', slugify(self['meta']['title']))        
     self['id'] = '/'.join(path)
Пример #2
0
def save_gallery():
    data = request.json['data']
    data['id'] = slugify(data['title']) if data['id'] == 'new' else data['id']
    db.galleries.update({ 'id': data['id'] }, data, upsert=True)
    return { 'id': data['id'] }