﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23750	django.core.checks.register shouldn't be (primarily) a decorator	Shai Berger	averybigant	"`django.core.checks.register` is commonly used as a function, called from `AppConfig.ready()`, and not as a 
decorator; but it is defined as a decorator, so it looks a little funny:
{{{
        checks.register('models')(check_generic_foreign_keys)
}}}
(from the contenttypes AppConfig, for example).

Registering checks only in ready(), rather than at import time, is now the way 
to do things, so register() should typically not be used as a decorator; I 
think we should change its definition accordingly, to 
{{{
        def register(self, check, *tags)
}}}

-----

The above is, essentially, an old [https://groups.google.com/forum/#!msg/django-developers/jfnzeOnyBSU/FBc9i8iMc8oJ message] of mine to django-developers; in that thread, you can find Russell agreeing, and Marc adding that the checks documentation needs to change as well. However, since 1.7 was already released, `register` needs to be changed in a backwards-compatible way -- so that it can be used either as it is currently, or using the more natural style.

"	Cleanup/optimization	closed	Core (System checks)	1.7	Normal	fixed			Accepted	1	0	0	0	1	0
