Re: Primary key for read-only models

2012-01-14 Thread JohnA
I think you can do what you want as long as you set your read-only model to managed=False in the Meta. You have to set some field to primary_key=True but it doesn’t have to actually be unique. To avoid situations where django will do something that will only work if it is unique you might want to

Re: Primary key for read-only models

2012-01-13 Thread Simone Federici
Try this: https://github.com/simone/django-compositekey/wiki and send me feedback :-) On Thu, Jan 12, 2012 at 16:03, Demetrio Girardi wrote: > I need to read data from an "external" database table from my django > project. I am not interested in modifying the data, only reading it. > Of course

Re: Primary key for read-only models

2012-01-12 Thread Thorsten Sanders
Had recently kinda the same just that I have 2 tables without a primary key at all and I just declared one of the fields as primary key and works fine. On 12.01.2012 16:03, Demetrio Girardi wrote: I need to read data from an "external" database table from my django project. I am not interested

Re: Primary key for read-only models

2012-01-12 Thread Javier Guerra Giraldez
On Thu, Jan 12, 2012 at 10:03 AM, Demetrio Girardi wrote: > I have already done this previously, however in this case the table > has a multiple field primary key, unsupported by Django. There is no > other field which is guaranteed to be unique that I can use as primary > key in the Django model.