示例#1
0
def grid(options, id=None):
    if not id:
        id = 'grid_%s' % get_random_string(5)
    script = grid_script % (id, json.dumps(options))
    container = Html('div').attr('rest-grid', 'luxgrids.%s' % id)
    container.append(script)
    return container.render()
示例#2
0
文件: serialise.py 项目: tazo90/lux
 def as_dict(self, id=None, **attrs):
     data = self.layout.as_dict(self.form)
     form = data['field']
     if 'model' not in form:
         form['model'] = self.form.__class__.__name__
     if id is None and not form.get('id'):
         id = '%s_%s' % (self.form.__class__.__name__.lower(),
                         get_random_string(5))
     if id:
         form['id'] = id
     form.update(attrs)
     return data
示例#3
0
 def as_dict(self, id=None, **attrs):
     data = self.layout.as_dict(self.form)
     form = data['field']
     if 'model' not in form:
         form['model'] = self.form.__class__.__name__
     if id is None and not form.get('id'):
         id = '%s_%s' % (self.form.__class__.__name__.lower(),
                         get_random_string(5))
     if id:
         form['id'] = id
     form.update(attrs)
     return data