On Aug 19, 2:05 pm, Lee <
lhughe...@gmail.com> wrote:
> Landy - thanks for that idea. Am I correct in understanding that
> setting a field to AutoField has no effect on save_model, and simply
> causes dbsync to add the sequence/nextval to the Postgres table?
I am not sure; On a droid phone so I can't look at the source code or
run tests.
> If so
> that is my problem, because I want to have one database schema that
> works across different DBMSes, and the sequence/nextval syntax is
> Postgres-specific so I have not been using dbsync.
Django abstracts this away.. If django is creating your tables, you
can trust it will do The Right Thing(tm) for whatever DBMS you are
using. If you're not the trusting type you can run this command to
find out what django would do to create your tables:
django-admin.py sqlall
Then you can change the database_backend in settings.py to find out
what the differences would be.
> I was hoping AutoField caused the *application* to manage the auto-
> incrementing primary key, not the database -- is there an easy way to
> do this in Django/Admin?
That is almost never a good idea (*maybe* there is an edge case I've
never seen). It isn't easy to prevent collisions (two records with
same id). Imagine two users adding new records at the same time. Why
do that when the problem is already solved by your DBMS?
> Thanks very much for the help.
You're quite welcome!