Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #965 -- 'django-admin.py sqlsequencereset' now includes m2m tab…

…les. Thanks for reporting, exoweb adrian

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1517 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 38b8d180917ec4eaf3f12618d9114e08e3fad586 1 parent a58dc0d
Adrian Holovaty authored December 01, 2005

Showing 1 changed file with 3 additions and 0 deletions. Show diff stats Hide diff stats

  1. 3  django/core/management.py
3  django/core/management.py
@@ -238,6 +238,9 @@ def get_sql_sequence_reset(mod):
238 238
                 output.append("SELECT setval('%s_%s_seq', (SELECT max(%s) FROM %s));" % \
239 239
                     (klass._meta.db_table, f.column, db.db.quote_name(f.column),
240 240
                     db.db.quote_name(klass._meta.db_table)))
  241
+        for f in klass._meta.many_to_many:
  242
+            output.append("SELECT setval('%s_id_seq', (SELECT max(%s) FROM %s));" % \
  243
+                (f.get_m2m_db_table(klass._meta), db.db.quote_name('id'), f.get_m2m_db_table(klass._meta)))
241 244
     return output
242 245
 get_sql_sequence_reset.help_doc = "Prints the SQL statements for resetting PostgreSQL sequences for the given model module name(s)."
243 246
 get_sql_sequence_reset.args = APP_ARGS

0 notes on commit 38b8d18

Please sign in to comment.
Something went wrong with that request. Please try again.