0

Running through the polls tutorial I ran this line:

q = Question(question_text="What's new?", pub_date=timezone.now())

Now, I've already ran:

python manage.py flush

But when I save and check the ID, I noticed that the id is still incrementing.

>>> q.save()
>>>q.id
3

Why is the id value not 1? Why are the id values preserved even though the db was destroyed?

deedle
  • 105
  • 11

1 Answers1

0

You can try by deleting all tables using manage.py sqlclear before using manage.py flush which empties the data in all tables.

Then you can re-sync the tables according to your defined model with manage.py syncdb.

Maybe it would make your life easier to use south to make database migrations or some Django Extensions.

Agustin Castro
  • 281
  • 3
  • 11