Simple fix in foreignkeyfields and addded new features for pass arguments to forms via model field

This commit is contained in:
Antonio de la Rosa 2016-01-26 17:59:02 +01:00
parent ae2e94d224
commit a57f714cd2
5 changed files with 28 additions and 9 deletions

View file

@ -25,7 +25,7 @@ class BaseForm {
public $enctype=0;
public function __construct($name, $value)
public function __construct($name, $value, $extra_parameters=array())
{
$this->label=$name;
$this->name=$name;

View file

@ -13,13 +13,26 @@ class SelectModelForm extends SelectForm{
public $model;
public $conditions='WHERE 1=1';
public $conditions=['WHERE 1=1', []];
public $field_value='';
public $field_name='';
public $raw_query=0;
public function __construct($name, $value, $model, $field_name, $field_value)
{
parent::__construct($name, $value);
$this->model=&$model;
$this->field_name=$field_name;
$this->field_value=$field_value;
}
public function form()
{
@ -32,7 +45,7 @@ class SelectModelForm extends SelectForm{
}
$this->model->set_conditions($this->conditions);
$this->model->set_conditions($this->conditions[0], $this->conditions[1]);
$query=$this->model->select(array($this->field_name, $this->field_value), $this->raw_query);