Hi,
I have been working with the ModelAdmin for a few days now and it works beatifully with the exception of many to many relationships; so any help fixing or working around this will be awesome
Model Admin class
class PortfolioAdmin extends ModelAdmin {
protected static $managed_models = array(
'Project',
'Category',
'Client',
'Technology'
);
static $url_segment = 'projects'; // will be linked as /admin/products
static $menu_title = 'Portfolio Admin';
}
Project class
class Project extends DataObject {
static $db = array(
'Name' => 'Varchar',
'ProjectCode' => 'Varchar',
'Description' => 'Text',
'Budget' => 'Currency'
);
static $many_many = array(
'Category' => 'Category',
'Technology' => 'Technology'
);
static $has_one = array(
'Client' => 'Client'
);
static $searchable_fields = array(
'Name',
'ProjectCode'
);
}
Category class
class Category extends DataObject {
static $db = array(
'Title' => 'Text',
'Description' => 'Text'
);
static $belongs_many_many = array(
'Project' => 'Project'
);
}
Technology Class
class Technology extends DataObject {
static $db = array(
'TechName' => 'Varchar',
'TechVersion' => 'Varchar',
'Description' => 'Text'
);
static $belongs_many_many = array(
'Project' => 'Project'
);
}
Client class
class Client extends DataObject{
static $db = array(
'Title' => 'Varchar',
'Company' => 'Varchar',
'ContactName' => 'Varchar',
'Webpage' => 'Varchar',
'Email' => 'Varchar'
);
static $has_one = array(
);
static $field_names = array(
'Title' => 'Title'
);
static $searchable_fields = array(
'Title',
'Email'
);
}