Opened 16 years ago
Closed 16 years ago
#8331 closed (fixed)
manage.py sqlclear and friends crash, for unknown reasons
Reported by: | Dougal Sutherland | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When I run manage.py sqlclear, it often crashes with the following traceback:
$ ./manage.py sqlclear tests Traceback (most recent call last): File "./manage.py", line 11, in <module> execute_manager(settings) File "/Library/Python/2.5/site-packages/django/core/management/__init__.py", line 334, in execute_manager utility.execute() File "/Library/Python/2.5/site-packages/django/core/management/__init__.py", line 295, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 77, in run_from_argv self.execute(*args, **options.__dict__) File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 96, in execute output = self.handle(*args, **options) File "/Library/Python/2.5/site-packages/django/core/management/base.py", line 146, in handle app_output = self.handle_app(app, **options) File "/Library/Python/2.5/site-packages/django/core/management/commands/sqlclear.py", line 10, in handle_app return u'\n'.join(sql_delete(app, self.style)).encode('utf-8') File "/Library/Python/2.5/site-packages/django/core/management/sql.py", line 98, in sql_delete output.extend(connection.creation.sql_destroy_model(model, references_to_delete, style)) File "/Library/Python/2.5/site-packages/django/db/backends/creation.py", line 263, in sql_destroy_model output.extend(self.sql_remove_table_constraints(model, references_to_delete, style)) TypeError: sql_remove_table_constraints() takes exactly 3 arguments (4 given)
As far as I can tell, though, sql_remove_table_constraints() does actually want four arguments (including self).
An example for which this happens is a simple project, with only the one app installed, whose models.py looks like
from django.db import models class Watcher(models.Model): user = models.ForeignKey('User') class User(models.Model): pass
If you switch the order of the definitions, however, it works fine (outputting the appropriate DROP statements).
Note:
See TracTickets
for help on using tickets.
(In [8364]) Fixed #8331 -- Added style parameter to sqlite backend implementation of sql_remove_table_constraints, missed in recent db backend refactor. Thanks to d00gs for the report.