没有从我的模型基类创建数据库表

时间:2016-09-03 16:59:01

标签: python-3.x django-forms

我正在尝试构建一个日志应用程序,用于在数据库中存储日期,练习类型,持续时间和注释。它呈现我期望的形式,但它不会从我的基类创建数据库表。我只是陷入困境,希望任何人都可以帮助我解决问题。

private function upload_file($name ='',$sno = 0)
{
    if($name=='rtifile'){   $config['upload_path'] = 'assets/rti_uploads/rti_file/';    }
    if($name=='coverletter'){   $config['upload_path'] = 'assets/rti_uploads/cover_letter/';    }
    if($name=='fullreply'){ $config['upload_path'] = 'assets/rti_uploads/full_reply/';  }
    $config['allowed_types'] = 'pdf';
    $config['max_size']  = '2050';


        if(isset($_FILES[$name]['name']))
        {
            if($_FILES[$name]['name'] == "")
                $filename = "";
            else
            {
                $filename=$this->security->sanitize_filename(strtolower($_FILES[$name]['name']));
                $ext =  strrchr( $filename, '.' ); 
                if($name=='rtifile'){   $filename='RTI_'.$sno.'_'.date('YmdHis').$ext;  }
                if($name=='coverletter'){   $filename='COVER_'.$sno.'_'.date('YmdHis').$ext;    }
                if($name=='fullreply'){ $filename='FULLREPLY_'.$sno.'_'.date('YmdHis').$ext;    }
            }
        }
        else
        {
            $this->session->set_flashdata('flashError','ERROR: File Name not set.');
            redirect('rti/rti_file');
            return FALSE;
        }

        $config['file_name'] = $filename;

        if(!is_dir($config['upload_path'])) 
        {
            mkdir($config['upload_path'],0777,TRUE);
        }

        $this->load->library('upload', $config);
        $this->upload->initialize($config);

        if ( ! $this->upload->do_upload($name)) 
        {
            $this->session->set_flashdata('flashError',$this->upload->display_errors('',''));
            redirect('rti/rti_file');
            return FALSE;
        }
        else
        {
            $upload_data = $this->upload->data();
            return $upload_data;
        }
}

0 个答案:

没有答案