It looks like you are trying to emulate a many-to-many relationship between two models. Tables 1 and 2 would be generated by model definitions, and table 3 would be created automagically by linking the two models together via a M2M field (which would NOT add an 'id' field as you've requested IIRC). Check out the documentation on the Django ORM, this section specifically:
https://docs.djangoproject.com/en/1.6/topics/db/models/#many-to-many-relationships This would only apply if you intend to use Django's ORM (which I recommend in this simple example, and in almost every other example ever). Alternatively, there is nothing stopping you from using whatever schema you like, as you can generate queries on your own, although I think the ORM would provide a large benefit both in code efficiency and security. I have yet to find an instance where the ORM is not simpler to use than a custom query, although advanced schema's with pre-existing data or extreme query optimization may call for it. In general, though, if the ORM doesn't seem to fit, usually it is due to a design that hasn't been thought out enough. The Django developers have seen a database or two in their time. Have a bit of faith in their well-proven ORM abstraction layer, you'll be pleasantly surprised. -James On Friday, May 2, 2014, Igor Korot <[email protected]> wrote: > Hi, ALL, > This is my first official post here so be gentle... ;-) > > I'm trying to make an application based on the following db structure: > > table 1: id - primary key, fname char(40), lname char(40) > table 2: id - primary key, position char(20) > table 3: table1_id, table2_id - foreign key > > Now, from what I understand Django does not work well with tables > without PK. So in order to make it around it just makes a bogus > primary key in the table called id. > > What I'd like to know is this: there is no point of creating a PK for > a table 3. In fact it is wrong as it completely destroys the purpose > of the db schema. > Can I prevent the creation of the PK in this one table somehow? If its > not possible, is there a place where I can submit this as a > bug/feature request? > > Thank you for any help. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] <javascript:;>. > To post to this group, send email to > [email protected]<javascript:;> > . > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CA%2BFnnTyii-umGTL%3D81PWWQP07ubyheZfTzmT5p%2Bzide-T0FvhA%40mail.gmail.com > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVwJ%3DsOWi9hfsrcYw_Ojd_ZyRzsvzgOc7Y4Rkmt5VMW2g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

