Thanks! AutoField did the trick.
Tom
Robin Munn gmail.com> writes:
> Django will only auto-increment fields listed as AutoField. If you use
> any other type (CharField, IntegerField), it's assumed that you want
> to specify the primary key yourself each time.
The only drawback seems that you can never specify the id when you use
On 8/19/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> ---
> Here's my class definition:
> ---
>
> class Notify(meta.Model):
> db_table = 'notify'
> fields = (
> meta.IntegerField('id', pri
If you created the database from scratch (i.e. if you're not using an
existing database) you shouldn't need to have the line:
meta.IntegerField('id', primary_key=True),
the primary key would be created automatically. If that's the case you
might want to try creating the tables again.
If I understand things correctly, Django creates an 'id' field for each
model automatically, I assume set to unique and to auto-increment, thus
avoiding the problem you are seeing.
The easiest thing to do is not to create your own 'id' field and use
the one Django puts in place for you.
jtm
5 matches
Mail list logo