Example #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()
Example #2
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
Example #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