First, a question of this sort is better suited to django-users, as
django-dev django-dev is for discussion of the development of Django
itself.
Second, from what I can tell db_dump.py is not part of the official
trunk -- thus I'm not familiar with it. My priority is to have
compatibility with the features already within Django before I worry
about third-party scripts.
Finally, `django_session_id_seq` tells me that the error is related to
the sessions framework, django.contrib.sessions (which is included in
INSTALLED_APPS by default). In the code for the Session model, the
primary key is manually specified for the `session_key` field --
therefore no AutoField is created for the Session model. My guess is
the bug lies with the script's handling of models that use primary
keys outside the implicit AutoField -- most likely this is not related
to GeoDjango.
-Justin
Thanks for clearing this up,
Matt
def setSequence(cursor, model):
from django.conf import settings
# postgresql: reset sequence
if settings.DATABASE_ENGINE in ('postgresql_psycopg2', 'postgresql'):
cursor.execute('SELECT count(*) + 1 FROM %s;' %
quote_name(model._meta.db_table))
nb = cursor.fetchall()[0][0]
seq = quote_name(model._meta.db_table + '_id_seq')
cursor.execute('ALTER SEQUENCE %s RESTART WITH %d;' % (seq, nb))
So I think maybe this function makes the bug, and can someone help me to fix it?
--
I like python!
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
meide <<wxPython UI module>>: http://code.google.com/p/meide/
My Blog: http://www.donews.net/limodou
# postgresql: reset sequence
if settings.DATABASE_ENGINE in ('postgresql_psycopg2',
'postgresql'):
try:
f = model._meta.get_field('id')
except FieldDoesNotExist:
f = None
if f and isinstance(f, models.AutoField):
cursor.execute('SELECT count(*) + 1 FROM %s;' %
quote_name(model._meta.db_table))
nb = cursor.fetchall()[0][0]
seq = quote_name(model._meta.db_table + '_id_seq')
cursor.execute('ALTER SEQUENCE %s RESTART WITH %d;' % (seq,
nb))
this should work i think
On Oct 27, 3:43 am, limodou <limo...@gmail.com> wrote: