>
> Hi,
> I saw few questions from people who wonder how to manage tables
> without primary key (when using inspectdb on a legacy db);
> A great hope is born: I just discovered that this problem could be
> adressed, at least it works with sqlite:
>
> just add this field (rowid or oid is the sqlite automatic pk) in the
> model:
>
> rowid = models.IntegerField(primary_key=True, editable=False)
>
> It works ! it's so simple ! I love django !
>
> Maybe this tip could be added in the doc; for others sgbd, there must
> be something similar.
> And why not put this in the inspectdb command ...
Because it's a dirty, dirty hack.
I think the solutions are 1) use primary keys or 2) use dirty hacks.
-Dave
I would be surprised if it works with Oracle, unless you replace
IntegerField with CharField(max_length=18).