Run sqlsequencereset on all apps

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import os

os.environ['DJANGO_COLORS'] = 'nocolor'

from django.core.management import call_command
from django.conf import settings
from django.db import connection
from django.db.models.loading import get_app
from StringIO import StringIO

commands = StringIO()
cursor = connection.cursor()

for app in settings.INSTALLED_APPS:
    label = app.split('.')[-1]
    if get_app(label, emptyOK=True):
        call_command('sqlsequencereset', label, stdout=commands)

cursor.execute(commands.getvalue())

More like this

  1. Autoload Django Models When Using ./manage.py shell by sheats 5 years, 4 months ago
  2. Encryption Fields by zbyte64 4 years, 7 months ago
  3. immitating 'real' post_syncdb signal by jango 3 years, 1 month ago
  4. extras.py for management commands by dnordberg 5 years, 9 months ago
  5. Conditional url pattern include by zbyte64 2 years, 9 months ago

Comments

(Forgotten your password?)