how to description FK which contains more than 1 field

2015-08-10 Thread Holland_zwz
Hi all, I have 2 tables, one is A another is B, and B have one FK which contains more than 1 field references to A. The table struct is here: create table A ( oid int not null, types varchar(20) not null, name varchar(30) null, color varchar(20) null, constraint PK_A primary key (oi

About the auto-increase PK

2015-08-08 Thread Holland_zwz
Hi all, I want to add one auto-increase PK which start from one given value(such as start from 1000). I try to write the model as following: class MyModel(models.Model): mid = models.AutoField(verbose_name='My ID',primary_key=True,default='1000') But only one record can be add when i add

Re: how to descript the many to one relationship in model when there are more than 1 tables

2015-08-06 Thread Holland_zwz
oking for a many-to-many relationship using an > intermediary table: > > > https://docs.djangoproject.com/en/1.8/topics/db/models/#intermediary-manytomany > > -James > On Aug 6, 2015 3:06 AM, "Holland_zwz" > > wrote: > >> Sometimes table have more tha

how to descript the many to one relationship in model when there are more than 1 tables

2015-08-06 Thread Holland_zwz
Sometimes table have more than one foreign key reference to other tables. Then how to descript it in model? For eg: Table A: create table A ( oid varchar(10) not null, pid varchar(10) not null, color varchar(20)