diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-07-29 23:41:05 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-07-29 23:41:05 +0000 |
| commit | b7643d009eea7547b7f65b20c27369bb223290fd (patch) | |
| tree | 779f7db9ddc559fa1c145c2a1e6782ad77044d2d /tests | |
| parent | 7b6c472167cb8e0f66286c75e76f4f326e5caa56 (diff) | |
Added 'API reference' section to generated model examples
git-svn-id: http://code.djangoproject.com/svn/django/trunk@352 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/builddocs.py | 16 |
1 files changed, 16 insertions, 0 deletions
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 = """ <h2>Model source code</h2> <pre class="literal-block">{{ model_source }}</pre> +<h2>API reference</h2> + +{% for model in models %} +<h3>{{ model.name }} objects have the following methods:</h3> +<ul> +{% for method in model.methods %}<li><span class="pre">{{ method }}()</span></li> +{% endfor %}</ul> +{% endfor %} + <h2>Sample API usage</h2> <pre class="literal-block">{{ api_usage }}</pre> </div> @@ -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()) |
