Ticket #5405: 5405-2.diff

File 5405-2.diff, 2.1 KB (added by Elvard, 3 years ago)

Updated version

  • django/contrib/admindocs/templates/admin_doc/model_detail.html

    diff --git a/django/contrib/admindocs/templates/admin_doc/model_detail.html b/django/contrib/admindocs/templates/admin_doc/model_detail.html
    index 9fb4eee..987d85d 100644
    a b  
    2222
    2323{% block content %}
    2424<div id="content-main">
    25 <h1>{{ summary }}</h1>
    26 
    27 {% if description %}
    28   <p>{% filter linebreaksbr %}{% trans description %}{% endfilter %}</p>
    29 {% endif %}
     25<h1>{{ name }}</h1>
     26<h2>{% trans "Description" %}</h2>
     27{% if summary %}<strong>{% trans summary %}</strong>{% endif %}
     28{% if description %}<p>{% trans description %}</p>{% endif %}
    3029
     30<h2>{{ heading }}</h2>
    3131<div class="module">
    3232<table class="model">
    3333<thead>
  • django/contrib/admindocs/views.py

    diff --git a/django/contrib/admindocs/views.py b/django/contrib/admindocs/views.py
    index 94963b4..71924de 100644
    a b def model_detail(request, app_label, model_name): 
    196196
    197197    opts = model._meta
    198198
     199    title, description, metadata = utils.parse_docstring(model.__doc__)
     200    if title:
     201      title = utils.parse_rst(title, 'model', _('model:') + model_name)
     202    if description:
     203      description = utils.parse_rst(description, 'model', _('model:') + model_name)
     204    for key in metadata:
     205      metadata[key] = utils.parse_rst(metadata[key], 'model', _('model:') + model_name)
     206
    199207    # Gather fields/field descriptions.
    200208    fields = []
    201209    for field in opts.fields:
    def model_detail(request, app_label, model_name): 
    266274    return render_to_response('admin_doc/model_detail.html', {
    267275        'root_path': urlresolvers.reverse('admin:index'),
    268276        'name': '%s.%s' % (opts.app_label, opts.object_name),
    269         'summary': _("Fields on %s objects") % opts.object_name,
    270         'description': model.__doc__,
     277        'heading': _("Fields on %s objects") % opts.object_name,
     278        'summary': title,
     279        'description': description,
     280        'meta': metadata,
    271281        'fields': fields,
    272282    }, context_instance=RequestContext(request))
    273283
Back to Top