Admin validate() method suggests erroneous invocation?
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
According to the docstring for validate() in django.contrib.admin.validation (currently):
Calls custom validation classmethod in the end if it is provided in cls. The signature of the custom validation classmethod should be: def validate(cls, model).
I take this to mean that a ModelAdmin subclass may provide a validate method of it's own, to ensure additional checks are run. However, doing something like:
class MyModelAdmin(admin.ModelAdmin): [...] @classmethod def validate(cls, model): from pdb import set_trace; set_trace()
Never yields an interactive shell, nor can I see anywhere in the validation code where it might even be attempting to call it.
As it's undocumented, as far as I know (thus an internal API) this could be considered a case of:
- the docstring not being clear enough [at least, for me to understand]
- the docstring never being correct [because it has appeared that way since 1.0]
- the functionality having been removed at some point [perhaps wrongly]
Apologies if this is a dupe, but the search results were rather mired in form validation and the admin.
Change History (6)
comment:1 Changed 4 years ago by
|Patch needs improvement:||unset|
|Status:||new → closed|