def buildMetaData(self): self.metadata = {} if self.showmetadata: fields = meta_fields(self.model, self.mappings, self.exclude_fields, self.get_metadata, fields=self.fields) + self.extra_fields #print 'buildMetaData meta_fields', fields self.metadata = { 'idProperty': self.id_property, 'root': self.root, 'totalProperty': self.total, 'successProperty': self.success, 'fields': fields, 'messageProperty': self.message } if self.sort_info: self.metadata.update({'sortInfo': self.sort_info}) # if self.model.__name__ == 'User': # for field in fields: # if not field['allowBlank']: # print 'mandatory', field self.metadata.update(self.custom_meta)
def buildMetaData(self): self.metadata = {} if self.showmetadata: fields = meta_fields(self.model, self.mappings, self.exclude_fields, self.get_metadata, fields = self.fields) + self.extra_fields #print 'buildMetaData meta_fields', fields self.metadata = { 'idProperty': self.id_property, 'root': self.root, 'totalProperty': self.total, 'successProperty': self.success, 'fields': fields, 'messageProperty': self.message } if self.sort_info: self.metadata.update({'sortInfo': self.sort_info}) # if self.model.__name__ == 'User': # for field in fields: # if not field['allowBlank']: # print 'mandatory', field self.metadata.update(self.custom_meta)
def __init__(self, model, extras=[], root='records', total='total', \ success='success', message='message', start='start', limit='limit', \ sort='sort', dir='dir', metadata=False, id_property='id', \ mappings={}, sort_info={}, custom_meta={}, exclude_fields=[], \ extra_fields=[], get_metadata=None): self.model = model self.root = root self.total = total self.success = success self.extras = extras self.id_property = id_property self.message = message self.exclude_fields = exclude_fields # paramNames self.start = start self.limit = limit self.sort = sort self.dir = dir self.metadata = {} if metadata: fields = meta_fields(model, mappings, exclude_fields, get_metadata) + extra_fields self.metadata = { 'idProperty': id_property, 'root': root, 'totalProperty': total, 'successProperty': success, 'fields': fields, 'messageProperty': message } if sort_info: self.metadata.update({'sortInfo': sort_info}) self.metadata.update(custom_meta)