});
+Gilbert.lib.plugins.models.ui.ForeignKeyColumn = Ext.extend(Ext.grid.Column, {
+ renderer: function(v) {
+ return v.__unicode__
+ }
+})
+
+
+Ext.grid.Column.types['foreignkeycolumn'] = Gilbert.lib.plugins.models.ui.ForeignKeyColumn
+
+
Gilbert.lib.plugins.models.ui.ModelPanel = Ext.extend(Ext.Panel, {
constructor: function (model, plugin, config) {
var model = this.model = model;
@property
def data_columns_spec(self):
spec = []
+
for field_name in self.data_columns:
column = {
'dataIndex': field_name,
column['sortable'] = True
if field_name in self.data_editable_columns:
column['editable'] = True
+ if field_name in [field.name for field in self.model_meta.fields if isinstance(field.rel, ManyToOneRel)]:
+ column['xtype'] = 'foreignkeycolumn'
spec.append(column)
return spec