this is part of the database. The extention is .sql
-- phpMyAdmin SQL Dump
-- version 3.2.0.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: May 20, 2011 at 05:08 PM
-- Server version: 5.1.36
-- PHP Version: 5.2.9-2
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `bincomphptest`
--
-- --------------------------------------------------------
--
-- Table structure for table `agentname`
--
DROP TABLE IF EXISTS `agentname`;
CREATE TABLE IF NOT EXISTS `agentname` (
`name_id` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(255) NOT NULL,
`lastname` varchar(255) NOT NULL,
`email` varchar(255) DEFAULT NULL,
`phone` char(13) NOT NULL,
`pollingunit_uniqueid` int(11) NOT NULL,
PRIMARY KEY (`name_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
I was creating a new database on django with mysqlite but I think I’m inexperience and this maybe possible
2
Answers
To interpret these values in django you must look carefully at each field type so that you can create the variables that will store these values, such as
name_id
,firstname
,lastname
…this example should work once the table has been defined in
models
and that you have added the respective app'exampleApp.apps...'
insettings.py
.Django can read legacy databases and even auto-generate the models for them,
connect to the db from settings and then run this command from your terminal
it will print the models and you can use it as normal Django models