У меня есть следующая модель.
from django.db import models
class Client(models.Model):
postcode = models.CharField(max_length=10)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
address = models.TextField(blank=True)
phone = models.IntegerField(blank=True)
email = models.EmailField(blank=True)
url = models.URLField(blank=True)
client_since = models.DateTimeField('Client Since')
def __unicode__(self):
return self.first_name
def client_since(self):
return self.client_since.date() == datetime.date.today()
class Contractor(models.Model):
postcode = models.CharField(max_length=10)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
address = models.TextField(blank=True)
phone = models.IntegerField(blank=True)
email = models.EmailField(blank=True)
contractor_since = models.DateTimeField('Contractor Since')
def __unicode__(self):
return self.first_name
def contractor_since(self):
return self.contractor_since.date() == datetime.date.today()
Я запускаю «python manage.py validate» - 0 ошибок найдено
Затем я запускаю 'python manage.py sql "appname" и вижу свои таблицы ...
BEGIN;
CREATE TABLE "schedule_client" (
"id" integer NOT NULL PRIMARY KEY,
"postcode" varchar(10) NOT NULL,
"first_name" varchar(100) NOT NULL,
"last_name" varchar(100) NOT NULL,
"address" text NOT NULL,
"phone" integer NOT NULL,
"email" varchar(75) NOT NULL,
"url" varchar(200) NOT NULL,
"client_since" datetime NOT NULL
)
;
CREATE TABLE "schedule_contractor" (
"id" integer NOT NULL PRIMARY KEY,
"postcode" varchar(10) NOT NULL,
"first_name" varchar(100) NOT NULL,
"last_name" varchar(100) NOT NULL,
"address" text NOT NULL,
"phone" integer NOT NULL,
"email" varchar(75) NOT NULL
)
;
COMMIT;
Но я не вижу "contracor_since в таблице подрядчиков ... поле db создается ??? Я пробовал несколько раз, я использую django 1.1.1 на OS X Leopard.
Что я делаю не так?