Ticket #17599: 17599-draft.patch

File 17599-draft.patch, 2.0 KB (added by Aymeric Augustin, 13 years ago)
  • django/contrib/admindocs/views.py

     
    193193    if model is None:
    194194        raise Http404(_("Model %(model_name)r not found in app %(app_label)r") % {'model_name': model_name, 'app_label': app_label})
    195195
     196    title, body, metadata = utils.parse_docstring(model.__doc__)
     197    if title:
     198        title = utils.parse_rst(title, 'model', _('model:') + model_name)
     199    if body:
     200        body = utils.parse_rst(body, 'model', _('model:') + model_name)
     201    for key in metadata:
     202        metadata[key] = utils.parse_rst(metadata[key], 'model', _('model:') + model_name)
     203
    196204    opts = model._meta
    197205
    198206    # Gather fields/field descriptions.
     
    265273    return render_to_response('admin_doc/model_detail.html', {
    266274        'root_path': urlresolvers.reverse('admin:index'),
    267275        'name': '%s.%s' % (opts.app_label, opts.object_name),
    268         'summary': _("Fields on %s objects") % opts.object_name,
    269         'description': model.__doc__,
     276        'heading': _("Fields on %s objects") % opts.object_name,
     277        'summary': title,
     278        'body': body,
     279        'meta': metadata,
    270280        'fields': fields,
    271281    }, context_instance=RequestContext(request))
    272282
  • django/contrib/admindocs/templates/admin_doc/model_detail.html

     
    2323
    2424{% block content %}
    2525<div id="content-main">
    26 <h1>{{ summary }}</h1>
     26<h1>{{ name }}</h1>
    2727
    28 {% if description %}
    29   <p>{% filter linebreaksbr %}{% trans description %}{% endfilter %}</p>
    30 {% endif %}
     28<h2>{% trans "Description" %}</h2>
    3129
     30<strong>{{ summary }}</strong>
     31
     32{{ body }}
     33
     34<h2>{% trans "Fields" %}</h2>
     35
    3236<div class="module">
    3337<table class="model">
    3438<thead>
Back to Top