#22526 closed Cleanup/optimization (fixed)
New check method on models not documented in release notes
Description ¶
Django 1.7 adds a new check
command for models that is called on the class. As far as I can tell, this is only mentioned (briefly) in the documentation for the check framework.
https://docs.djangoproject.com/en/1.7/topics/checks/#field-model-and-manager-checks
If users create a model that has a method check
, calling manage.py check
will fail (because of the conflicting method names).
Traceback (most recent call last): File "manage.py", line 12, in <module> execute_from_command_line(sys.argv) File "/home/<>/.virtualenvs/<>/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 427, in execute_from_command_line utility.execute() File "/home/<>/.virtualenvs/<>/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 419, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/<>/.virtualenvs/<>/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "/home/<>/.virtualenvs/<>/local/lib/python2.7/site-packages/django/core/management/base.py", line 337, in execute output = self.handle(*args, **options) File "/home/<>/.virtualenvs/<>/local/lib/python2.7/site-packages/django/core/management/commands/check.py", line 39, in handle self.check(app_configs=app_configs, tags=tags, display_num_errors=True) File "/home/<>/.virtualenvs/<>/local/lib/python2.7/site-packages/django/core/management/base.py", line 370, in check all_issues = checks.run_checks(app_configs=app_configs, tags=tags) File "/home/<>/.virtualenvs/<>/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 59, in run_checks new_errors = check(app_configs=app_configs) File "/home/<>/.virtualenvs/<>/local/lib/python2.7/site-packages/django/core/checks/model_checks.py", line 16, in check_all_models if app_configs is None or model._meta.app_config in app_configs] TypeError: unbound method check() must be called with [model name] instance as first argument (got nothing instead)
This is not mentioned in the release notes for Django 1.7 at all and worked fine in previous versions:
Change History (6)
comment:1 by , 11 years ago
Severity: | Normal → Release blocker |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
by , 11 years ago
Attachment: | 22526.diff added |
---|
comment:2 by , 11 years ago
Has patch: | set |
---|
comment:3 by , 11 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
LGTM.