diff --git a/tests/builddocs.py b/tests/builddocs.py index 17da30050a..f0d57b61b9 100755 --- a/tests/builddocs.py +++ b/tests/builddocs.py @@ -17,6 +17,15 @@ MODEL_DOC_TEMPLATE = """

Model source code

{{ model_source }}
+

API reference

+ +{% for model in models %} +

{{ model.name }} objects have the following methods:

+ +{% endfor %} +

Sample API usage

{{ api_usage }}
@@ -46,6 +55,13 @@ def make_docs_from_model_tests(output_dir): model_source = model_source.replace('API_TESTS = ', '') model_source = model_source.strip() + models = [] + for m in mod._MODELS: + models.append({ + 'name': m._meta.object_name, + 'methods': [method for method in dir(m) if not method.startswith('_')], + }) + # Run this through the template system. t = template.Template(MODEL_DOC_TEMPLATE) c = template.Context(locals())