documentation models skips some methods
|Reported by:||miked@…||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
Admin docs are brilliant and the documentation at https://docs.djangoproject.com/en/dev/ref/contrib/admin/admindocs/#model-reference optimistically says "The models section of the admindocs page describes each model in the system along with all the fields and methods available on it."
In fact it skips methods unless they have exactly one argument.
This bothers me because I sometimes want model methods to have additional args. It would be better to permit any number of args.
In contrib/admindocs/views.py at the end of line 235 if one adjusts == 1 to > 0 it reveals the skipped methods with no apparent side effects.
There must be a reason it was set this way but maybe it is no longer an issue.
Here is the patch:
+++ contrib/admindocs/views.py Fri Oct 12 16:31:45 2012 @@ -232,7 +232,7 @@ # Gather model methods. for func_name, func in model.__dict__.items(): - if (inspect.isfunction(func) and len(inspect.getargspec(func)) == 1): + if (inspect.isfunction(func) and len(inspect.getargspec(func)) > 0): try: for exclude in MODEL_METHODS_EXCLUDE: if func_name.startswith(exclude):
If this patch is accepted, it makes the app match the documentation so no change to the docs would be required.