Re: Remove autogenerated 'id' when using existing database

2015-04-28 Thread Thorsten Sanders
I do that since years with tables not having a primary key without problems, but I am only using django orm on those to select data. Am 28.04.2015 17:35, schrieb Ben L: It is true that the table doesn't have a primary key. 1, I might be able to talk to the DBA to add a primary key in here and

Re: Remove autogenerated 'id' when using existing database

2015-04-28 Thread Ben L
It is true that the table doesn't have a primary key. 1, I might be able to talk to the DBA to add a primary key in here and re-sync the class. But is that required for each table to have pk to run Django? 2, what if I just modify the class to have fake pk =True, but not modify the database st

Re: Remove autogenerated 'id' when using existing database

2015-04-28 Thread Javier Guerra Giraldez
On Tue, Apr 28, 2015 at 1:59 AM, Ben in campus wrote: > That table does NOT have column 'id', so the generated models.py doesn't > have 'id' either. The model is unmanaged (managed = False). if your table has a primary key, add the primary_key=True flag to that field and Django won't add an 'id'

Remove autogenerated 'id' when using existing database

2015-04-28 Thread Ben in campus
Django Version: (1, 8, 0, 'final', 0) Issue: I have an existing database, so I integrated it following the instruction in https://docs.djangoproject.com/en/1.8/howto/legacy-databases/ to inspectdb and generated models.py. That table does NOT have column 'id', so the generated models.py doesn't hav