> As you can see the 'rating' table has no separate primary key field.
Yeah, that is pretty commonplace (though not presently supported by
django), the natural primary key for a table may be composite...
> Here are the models created by Django with some my corrections:
>
[remember to set 'managed = False' on models you don't want django to
automanage. And your model class names should really be singular]
> DatabaseError: column ratings.id does not exist
> LINE 1: SELECT "ratings"."id", "ratings"."userid",
> "ratings"."moviei...
>
> Is there a way to tell Django, that 'Ratings' models does not have a
> separate primary key?
IFF you're only reading the data, not writing it, you can just flat out
lie to the django orm - make Rating unmanaged, tell it one of the
columns in Rating is the primary key (even if it's not really unique!),
and things may Happen To Work ...for reading. But it _will_ break
horribly upon writing and is undoubtedly unsupported by the django
developers.
> Or my only option is to add the column to the
> 'ratings' table?
>
That's a safer option if you can, and presently necessary if you want
writing to work via the django ORM for writing. Though it may annoy
many a relational purist, possibly including your local DBA.
A generally more powerful but more complicated ORM for python exists -
sqlalchemy - and can cope with composite keys, but obviously you don't
then get integration with the rest of django (there is a
django-sqlalchemy project but it wasn't far along last time I looked at
it, which was quite some time ago mind you).