Django

Code

Changeset 7967

Show
Ignore:
Timestamp:
07/18/08 18:54:34 (5 months ago)
Author:
brosner
Message:

Merged the newforms-admin branch into trunk.

This is a backward incompatible change. The admin contrib app has been
refactored. The newforms module has several improvements including FormSets?
and Media definitions.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r7908 r7967  
    7575    Paul Bissex <http://e-scribe.com/> 
    7676    Simon Blanchard 
     77    David Blewett <david@dawninglight.net> 
    7778    Matt Boersma <ogghead@gmail.com> 
    7879    boobsd@gmail.com 
     
    173174    Thomas Güttler <hv@tbz-pariv.de> 
    174175    dAniel hAhler 
     176    hambaloney 
    175177    Brian Harring <ferringb@gmail.com> 
    176178    Brant Harris 
     
    195197    james_027@yahoo.com 
    196198    jcrasta@gmail.com 
     199    jdetaeye 
    197200    Zak Johnson <zakj@nox.cx> 
    198201    Nis Jørgensen <nis@superlativ.dk> 
     
    242245    limodou 
    243246    Philip Lindborg <philip.lindborg@gmail.com> 
     247    Simon Litchfield <simon@quo.com.au> 
    244248    Daniel Lindsley <polarcowz@gmail.com> 
    245249    Trey Long <trey@ktrl.com> 
     
    247251    Matt McClanahan <http://mmcc.cx/> 
    248252    Martin Maney <http://www.chipy.org/Martin_Maney> 
     253    Petr Marhoun <petr.marhoun@gmail.com> 
    249254    masonsimon+django@gmail.com 
    250255    Manuzhai 
     
    259264    Jason McBrayer <http://www.carcosa.net/jason/> 
    260265    mccutchen@gmail.com 
     266    Christian Metts 
    261267    michael.mcewan@gmail.com 
    262268    michal@plovarna.cz 
     
    271277    mrmachine <real.human@mrmachine.net> 
    272278    Robin Munn <http://www.geekforgod.com/> 
     279    msundstr 
    273280    Robert Myers <myer0052@gmail.com> 
    274281    Nebojša Dorđević 
     
    291298    pgross@thoughtworks.com 
    292299    phaedo <http://phaedo.cx/> 
     300    Julien Phalip <http://www.julienphalip.com> 
    293301    phil@produxion.net 
    294302    phil.h.smith@gmail.com 
     
    299307    Daniel Poelzleithner <http://poelzi.org/> 
    300308    polpak@yahoo.com 
     309    Matthias Pronk <django@masida.nl> 
    301310    Jyrki Pulliainen <jyrki.pulliainen@gmail.com> 
    302311    Johann Queuniet <johann.queuniet@adh.naellia.eu> 
     
    315324    Henrique Romano <onaiort@gmail.com> 
    316325    Armin Ronacher 
     326    Daniel Roseman <http://roseman.org.uk/>     
    317327    Brian Rosner <brosner@gmail.com> 
    318328    Oliver Rutherfurd <http://rutherfurd.net/> 
  • django/trunk/django/conf/project_template/urls.py

    r4265 r7967  
    11from django.conf.urls.defaults import * 
     2 
     3# Uncomment this for admin: 
     4#from django.contrib import admin 
    25 
    36urlpatterns = patterns('', 
     
    58    # (r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')), 
    69 
     10    # Uncomment this for admin docs: 
     11    #(r'^admin/doc/', include('django.contrib.admindocs.urls')), 
     12 
    713    # Uncomment this for admin: 
    8 #     (r'^admin/', include('django.contrib.admin.urls')), 
     14    #('^admin/(.*)', admin.site.root), 
    915) 
  • django/trunk/django/contrib/admindocs/views.py

    r6671 r7967  
    66from django.shortcuts import render_to_response 
    77from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist 
    8 from django.http import Http404 
     8from django.http import Http404, get_host 
    99from django.core import urlresolvers 
    10 from django.contrib.admin import utils 
     10from django.contrib.admindocs import utils 
    1111from django.contrib.sites.models import Site 
    1212from django.utils.translation import ugettext as _ 
     
    2424    if not utils.docutils_is_available: 
    2525        return missing_docutils_page(request) 
    26     return render_to_response('admin_doc/index.html', context_instance=RequestContext(request)) 
     26    root_path = re.sub(re.escape('doc/') + '$', '', request.path) 
     27    return render_to_response('admin_doc/index.html', { 
     28        'root_path': root_path, 
     29    }, context_instance=RequestContext(request)) 
    2730doc_index = staff_member_required(doc_index) 
    2831 
     
    3033    # Hack! This couples this view to the URL it lives at. 
    3134    admin_root = request.path[:-len('doc/bookmarklets/')] 
     35    root_path = re.sub(re.escape('doc/bookmarklets/') + '$', '', request.path) 
    3236    return render_to_response('admin_doc/bookmarklets.html', { 
     37        'root_path': root_path, 
    3338        'admin_url': mark_safe("%s://%s%s" % (request.is_secure() and 'https' or 'http', request.get_host(), admin_root)), 
    3439    }, context_instance=RequestContext(request)) 
     
    6267                'library': tag_library, 
    6368            }) 
    64  
    65     return render_to_response('admin_doc/template_tag_index.html', {'tags': tags}, context_instance=RequestContext(request)) 
     69    root_path = re.sub(re.escape('doc/tags/') + '$', '', request.path) 
     70    return render_to_response('admin_doc/template_tag_index.html', { 
     71        'root_path': root_path, 
     72        'tags': tags 
     73    }, context_instance=RequestContext(request)) 
    6674template_tag_index = staff_member_required(template_tag_index) 
    6775 
     
    93101                'library': tag_library, 
    94102            }) 
    95     return render_to_response('admin_doc/template_filter_index.html', {'filters': filters}, context_instance=RequestContext(request)) 
     103    root_path = re.sub(re.escape('doc/filters/') + '$', '', request.path) 
     104    return render_to_response('admin_doc/template_filter_index.html', { 
     105        'root_path': root_path, 
     106        'filters': filters 
     107    }, context_instance=RequestContext(request)) 
    96108template_filter_index = staff_member_required(template_filter_index) 
    97109 
     
    121133                'url': simplify_regex(regex), 
    122134            }) 
    123     return render_to_response('admin_doc/view_index.html', {'views': views}, context_instance=RequestContext(request)) 
     135    root_path = re.sub(re.escape('doc/views/') + '$', '', request.path) 
     136    return render_to_response('admin_doc/view_index.html', { 
     137        'root_path': root_path, 
     138        'views': views 
     139    }, context_instance=RequestContext(request)) 
    124140view_index = staff_member_required(view_index) 
    125141 
     
    140156    for key in metadata: 
    141157        metadata[key] = utils.parse_rst(metadata[key], 'model', _('view:') + view) 
     158    root_path = re.sub(re.escape('doc/views/%s/' % view) + '$', '', request.path) 
    142159    return render_to_response('admin_doc/view_detail.html', { 
     160        'root_path': root_path, 
    143161        'name': view, 
    144162        'summary': title, 
     
    151169    if not utils.docutils_is_available: 
    152170        return missing_docutils_page(request) 
    153  
    154171    m_list = [m._meta for m in models.get_models()] 
    155     return render_to_response('admin_doc/model_index.html', {'models': m_list}, context_instance=RequestContext(request)) 
     172    root_path = re.sub(re.escape('doc/models/') + '$', '', request.path) 
     173    return render_to_response('admin_doc/model_index.html', { 
     174        'root_path': root_path, 
     175        'models': m_list 
     176    }, context_instance=RequestContext(request)) 
    156177model_index = staff_member_required(model_index) 
    157178 
     
    159180    if not utils.docutils_is_available: 
    160181        return missing_docutils_page(request) 
    161  
     182         
    162183    # Get the model class. 
    163184    try: 
     
    171192            break 
    172193    if model is None: 
    173         raise Http404, _("Model %(name)r not found in app %(label)r") % {'name': model_name, 'label': app_label} 
     194        raise Http404, _("Model %(model_name)r not found in app %(app_label)r") % {'model_name': model_name, 'app_label': app_label} 
    174195 
    175196    opts = model._meta 
     
    183204            data_type = related_object_name = field.rel.to.__name__ 
    184205            app_label = field.rel.to._meta.app_label 
    185             verbose = utils.parse_rst((_("the related `%(label)s.%(type)s` object")  % {'label': app_label, 'type': data_type}), 'model', _('model:') + data_type) 
     206            verbose = utils.parse_rst((_("the related `%(app_label)s.%(data_type)s` object")  % {'app_label': app_label, 'data_type': data_type}), 'model', _('model:') + data_type) 
    186207        else: 
    187208            data_type = get_readable_field_data_type(field) 
     
    214235    # Gather related objects 
    215236    for rel in opts.get_all_related_objects(): 
    216         verbose = _("related `%(label)s.%(name)s` objects") % {'label': rel.opts.app_label, 'name': rel.opts.object_name} 
     237        verbose = _("related `%(app_label)s.%(object_name)s` objects") % {'app_label': rel.opts.app_label, 'object_name': rel.opts.object_name} 
    217238        accessor = rel.get_accessor_name() 
    218239        fields.append({ 
     
    226247            'verbose'   : utils.parse_rst(_("number of %s") % verbose , 'model', _('model:') + opts.module_name), 
    227248        }) 
    228  
     249    root_path = re.sub(re.escape('doc/models/%s.%s/' % (app_label, model_name)) + '$', '', request.path) 
    229250    return render_to_response('admin_doc/model_detail.html', { 
     251        'root_path': root_path, 
    230252        'name': '%s.%s' % (opts.app_label, opts.object_name), 
    231253        'summary': _("Fields on %s objects") % opts.object_name, 
     
    253275                'order': list(settings_mod.TEMPLATE_DIRS).index(dir), 
    254276            }) 
     277    root_path = re.sub(re.escape('doc/templates/%s/' % template) + '$', '', request.path) 
    255278    return render_to_response('admin_doc/template_detail.html', { 
     279        'root_path': root_path, 
    256280        'name': template, 
    257281        'templates': templates, 
  • django/trunk/django/contrib/admin/filterspecs.py

    r6671 r7967  
    1616class FilterSpec(object): 
    1717    filter_specs = [] 
    18     def __init__(self, f, request, params, model): 
     18    def __init__(self, f, request, params, model, model_admin): 
    1919        self.field = f 
    2020        self.params = params 
     
    2424    register = classmethod(register) 
    2525 
    26     def create(cls, f, request, params, model): 
     26    def create(cls, f, request, params, model, model_admin): 
    2727        for test, factory in cls.filter_specs: 
    2828            if test(f): 
    29                 return factory(f, request, params, model
     29                return factory(f, request, params, model, model_admin
    3030    create = classmethod(create) 
    3131 
     
    5353 
    5454class RelatedFilterSpec(FilterSpec): 
    55     def __init__(self, f, request, params, model): 
    56         super(RelatedFilterSpec, self).__init__(f, request, params, model
     55    def __init__(self, f, request, params, model, model_admin): 
     56        super(RelatedFilterSpec, self).__init__(f, request, params, model, model_admin
    5757        if isinstance(f, models.ManyToManyField): 
    5858            self.lookup_title = f.rel.to._meta.verbose_name 
     
    8282 
    8383class ChoicesFilterSpec(FilterSpec): 
    84     def __init__(self, f, request, params, model): 
    85         super(ChoicesFilterSpec, self).__init__(f, request, params, model
     84    def __init__(self, f, request, params, model, model_admin): 
     85        super(ChoicesFilterSpec, self).__init__(f, request, params, model, model_admin
    8686        self.lookup_kwarg = '%s__exact' % f.name 
    8787        self.lookup_val = request.GET.get(self.lookup_kwarg, None) 
     
    9999 
    100100class DateFieldFilterSpec(FilterSpec): 
    101     def __init__(self, f, request, params, model): 
    102         super(DateFieldFilterSpec, self).__init__(f, request, params, model
     101    def __init__(self, f, request, params, model, model_admin): 
     102        super(DateFieldFilterSpec, self).__init__(f, request, params, model, model_admin
    103103 
    104104        self.field_generic = '%s__' % self.field.name 
     
    134134 
    135135class BooleanFieldFilterSpec(FilterSpec): 
    136     def __init__(self, f, request, params, model): 
    137         super(BooleanFieldFilterSpec, self).__init__(f, request, params, model
     136    def __init__(self, f, request, params, model, model_admin): 
     137        super(BooleanFieldFilterSpec, self).__init__(f, request, params, model, model_admin
    138138        self.lookup_kwarg = '%s__exact' % f.name 
    139139        self.lookup_kwarg2 = '%s__isnull' % f.name 
     
    160160# more appropriate, and the AllValuesFilterSpec won't get used for it. 
    161161class AllValuesFilterSpec(FilterSpec): 
    162     def __init__(self, f, request, params, model): 
    163         super(AllValuesFilterSpec, self).__init__(f, request, params, model
     162    def __init__(self, f, request, params, model, model_admin): 
     163        super(AllValuesFilterSpec, self).__init__(f, request, params, model, model_admin
    164164        self.lookup_val = request.GET.get(f.name, None) 
    165         self.lookup_choices = model._meta.admin.manager.distinct().order_by(f.name).values(f.name) 
     165        self.lookup_choices = model_admin.queryset(request).distinct().order_by(f.name).values(f.name) 
    166166 
    167167    def title(self): 
  • django/trunk/django/contrib/admin/__init__.py

    r4265 r7967  
     1from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL 
     2from django.contrib.admin.options import StackedInline, TabularInline 
     3from django.contrib.admin.sites import AdminSite, site 
     4 
     5def autodiscover(): 
     6    """ 
     7    Auto-discover INSTALLED_APPS admin.py modules and fail silently when  
     8    not present. This forces an import on them to register any admin bits they 
     9    may want. 
     10    """ 
     11    from django.conf import settings 
     12    for app in settings.INSTALLED_APPS: 
     13        try: 
     14            __import__("%s.admin" % app) 
     15        except ImportError: 
     16            pass 
  • django/trunk/django/contrib/admin/media/css/forms.css

    r4979 r7967  
    5959.flatpages-flatpage #id_content { height:40.2em; } 
    6060.module table .vPositiveSmallIntegerField { width:2.2em; } 
     61 
     62/* x unsorted */ 
     63.inline-group {padding:10px; padding-bottom:5px; background:#eee; margin:10px 0;} 
     64.inline-group h3.header {margin:-5px -10px 5px -10px; background:#bbb; color:#fff; padding:2px 5px 3px 5px; font-size:11px} 
     65.inline-related {margin-bottom:15px; position:relative;} 
     66.last-related {margin-bottom:0px;} 
     67.inline-related h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold;  color:#888; } 
     68.inline-related h2 b {font-weight:normal; color:#aaa;} 
     69.inline-related h2 span.delete {padding-left:20px; position:absolute; top:0px; right:5px;} 
     70.inline-related h2 span.delete label {margin-left:2px; padding-top:1px;} 
     71.inline-related fieldset {background:#fbfbfb;} 
     72.inline-related fieldset.module h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#bcd; color:#fff; } 
     73.inline-related.tabular fieldset.module table {width:100%;} 
     74 
     75.inline-group .tabular tr.has_original td {padding-top:2em;} 
     76.inline-group .tabular tr td.original { padding:2px 0 0 0; width:0; _position:relative; } 
     77.inline-group .tabular th.original {width:0px; padding:0;} 
     78.inline-group .tabular td.original p {position:absolute; left:0; height:1.1em; padding:2px 7px; overflow:hidden; font-size:9px; font-weight:bold; color:#666; _width:700px;     } 
     79.inline-group ul.tools {padding:0; margin: 0; list-style:none;} 
     80.inline-group ul.tools li {display:inline; padding:0 5px;} 
     81.inline-group ul.tools a.add {background:url(../img/admin/icon_addlink.gif) 0 50% no-repeat; padding-left:14px;} 
  • django/trunk/django/contrib/admin/media/js/admin/CollapsedFieldsets.js

    r3415 r7967  
    4848        var divs = fs.getElementsByTagName('div'); 
    4949        for (var i=0; i<divs.length; i++) { 
    50             if (divs[i].className.match(/\berror\b/)) { 
     50            if (divs[i].className.match(/\berrors\b/)) { 
    5151                return true; 
    5252            } 
  • django/trunk/django/contrib/admin/media/js/admin/RelatedObjectLookups.js

    r6691 r7967  
    1 // Handles related-objects functionality: lookup link for raw_id_admin=True 
     1// Handles related-objects functionality: lookup link for raw_id_fields 
    22// and Add Another links. 
    33 
     
    3030    var name = win.name.replace(/___/g, '.'); 
    3131    var elem = document.getElementById(name); 
    32     if (elem.className.indexOf('vRawIdAdminField') != -1 && elem.value) { 
     32    if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) { 
    3333        elem.value += ',' + chosenId; 
    3434    } else { 
  • django/trunk/django/contrib/admin/models.py

    r6671 r7967  
    22from django.contrib.contenttypes.models import ContentType 
    33from django.contrib.auth.models import User 
     4from django.contrib.admin.util import quote 
    45from django.utils.translation import ugettext_lazy as _ 
    56from django.utils.encoding import smart_unicode 
     
    5152        This is relative to the Django admin index page. 
    5253        """ 
    53         return mark_safe(u"%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, self.object_id)) 
     54        return mark_safe(u"%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, quote(self.object_id))) 
  • django/trunk/django/contrib/admin/templates/admin/auth/user/add_form.html

    r7294 r7967  
    99 
    1010<div class="form-row"> 
    11   {{ form.username.html_error_list }} 
     11  {{ form.username.errors }} 
     12  {# TODO: get required class on label_tag #} 
    1213  <label for="id_username" class="required">{% trans 'Username' %}:</label> {{ form.username }} 
    13   <p class="help">{{ username_help_text }}</p> 
     14  <p class="help">{{ form.username.help_text }}</p> 
    1415</div> 
    1516 
    1617<div class="form-row"> 
    17   {{ form.password1.html_error_list }} 
     18  {{ form.password1.errors }} 
     19  {# TODO: get required class on label_tag #} 
    1820  <label for="id_password1" class="required">{% trans 'Password' %}:</label> {{ form.password1 }} 
    1921</div> 
    2022 
    2123<div class="form-row"> 
    22   {{ form.password2.html_error_list }} 
     24  {{ form.password2.errors }} 
     25  {# TODO: get required class on label_tag #} 
    2326  <label for="id_password2" class="required">{% trans 'Password (again)' %}:</label> {{ form.password2 }} 
    2427  <p class="help">{% trans 'Enter the same password as above, for verification.' %}</p> 
    2528</div> 
    2629 
     30<script type="text/javascript">document.getElementById("id_username").focus();</script> 
     31 
    2732</fieldset> 
    2833{% endblock %} 
  • django/trunk/django/contrib/admin/templates/admin/auth/user/change_password.html

    r7294 r7967  
    33{% block extrahead %}{{ block.super }} 
    44<script type="text/javascript" src="../../../../jsi18n/"></script> 
    5 {% for js in javascript_imports %}{% include_admin_script js %}{% endfor %} 
    65{% endblock %} 
    76{% block stylesheet %}{% admin_media_prefix %}css/forms.css{% endblock %} 
     
    1918<div> 
    2019{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %} 
    21 {% if form.error_dict %} 
     20{% if form.errors %} 
    2221    <p class="errornote"> 
    23     {% blocktrans count form.error_dict.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} 
     22    {% blocktrans count form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} 
    2423    </p> 
    2524{% endif %} 
     
    3029 
    3130<div class="form-row"> 
    32   {{ form.password1.html_error_list }} 
     31  {{ form.password1.errors }} 
     32  {# TODO: get required class on label_tag #} 
    3333  <label for="id_password1" class="required">{% trans 'Password' %}:</label> {{ form.password1 }} 
    3434</div> 
    3535 
    3636<div class="form-row"> 
    37   {{ form.password2.html_error_list }} 
     37  {{ form.password2.errors }} 
     38  {# TODO: get required class on label_tag #} 
    3839  <label for="id_password2" class="required">{% trans 'Password (again)' %}:</label> {{ form.password2 }} 
    3940  <p class="help">{% trans 'Enter the same password as above, for verification.' %}</p> 
     
    4647</div> 
    4748 
    48 <script type="text/javascript">document.getElementById("{{ first_form_field_id }}").focus();</script> 
     49<script type="text/javascript">document.getElementById("id_password1").focus();</script> 
    4950</div> 
    5051</form></div> 
  • django/trunk/django/contrib/admin/templates/admin/base.html

    r7294 r7967  
    2323        </div> 
    2424        {% if user.is_authenticated and user.is_staff %} 
    25         <div id="user-tools"> 
    26         {% trans 'Welcome,' %} <strong>{% if user.first_name %}{{ user.first_name|escape }}{% else %}{{ user.username }}{% endif %}</strong>. 
    27         {% block userlinks %} 
    28         <a href="{% url django.contrib.admin.views.doc.doc_index %}">{% trans 'Documentation' %}</a> 
    29         / <a href="{% url django.contrib.auth.views.password_change %}">{% trans 'Change password' %}</a> 
    30         / <a href="{% url django.contrib.auth.views.logout %}">{% trans 'Log out' %}</a> 
    31         {% endblock %} 
    32         </div> 
     25        <div id="user-tools">{% trans 'Welcome,' %} <strong>{% if user.first_name %}{{ user.first_name|escape }}{% else %}{{ user.username }}{% endif %}</strong>. {% block userlinks %}<a href="{{ root_path }}doc/">{% trans 'Documentation' %}</a> / <a href="{{ root_path }}password_change/">{% trans 'Change password' %}</a> / <a href="{{ root_path }}logout/">{% trans 'Log out' %}</a>{% endblock %}</div> 
    3326        {% endif %} 
    3427        {% block nav-global %}{% endblock %} 
  • django/trunk/django/contrib/admin/templates/admin/change_form.html

    r7294 r7967  
    11{% extends "admin/base_site.html" %} 
    22{% load i18n admin_modify adminmedia %} 
     3 
    34{% block extrahead %}{{ block.super }} 
    45<script type="text/javascript" src="../../../jsi18n/"></script> 
    5 {% for js in javascript_imports %}{% include_admin_script js %}{% endfor %
     6{{ media }
    67{% endblock %} 
     8 
    79{% block stylesheet %}{% admin_media_prefix %}css/forms.css{% endblock %} 
     10 
    811{% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %} 
     12 
    913{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %} 
     14 
    1015{% block breadcrumbs %}{% if not is_popup %} 
    1116<div class="breadcrumbs"> 
     
    1520</div> 
    1621{% endif %}{% endblock %} 
     22 
    1723{% block content %}<div id="content-main"> 
    1824{% block object-tools %} 
     
    2632<div> 
    2733{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %} 
    28 {% if opts.admin.save_on_top %}{% submit_row %}{% endif %} 
    29 {% if form.error_dict %} 
     34{% if save_on_top %}{% submit_row %}{% endif %} 
     35{% if errors %} 
    3036    <p class="errornote"> 
    31     {% blocktrans count form.error_dict.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} 
     37    {% blocktrans count errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} 
    3238    </p> 
     39    <ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul> 
    3340{% endif %} 
    34 {% for bound_field_set in bound_field_sets %} 
    35    <fieldset class="module aligned {{ bound_field_set.classes }}"> 
    36     {% if bound_field_set.name %}<h2>{{ bound_field_set.name }}</h2>{% endif %} 
    37     {% if bound_field_set.description %}<div class="description">{{ bound_field_set.description|safe }}</div>{% endif %} 
    38     {% for bound_field_line in bound_field_set %} 
    39         {% admin_field_line bound_field_line %} 
    40         {% for bound_field in bound_field_line %} 
    41             {% filter_interface_script_maybe bound_field %} 
    42         {% endfor %} 
     41 
     42{% for fieldset in adminform %} 
     43  {% include "admin/includes/fieldset.html" %} 
     44{% endfor %} 
     45 
     46{% block after_field_sets %}{% endblock %} 
     47 
     48{% for inline_admin_formset in inline_admin_formsets %} 
     49    {% include inline_admin_formset.opts.template %} 
     50{% endfor %} 
     51 
     52{% block after_related_objects %}{% endblock %} 
     53 
     54{% submit_row %} 
     55 
     56{% if add %} 
     57   <script type="text/javascript">document.getElementById("{{ adminform.first_field.auto_id }}").focus();</script> 
     58{% endif %} 
     59 
     60{# JavaScript for prepopulated fields #} 
     61 
     62{% if add %} 
     63<script type="text/javascript"> 
     64{% for field in adminform.prepopulated_fields %} 
     65    document.getElementById("{{ field.field.auto_id }}").onchange = function() { this._changed = true; }; 
     66    {% for dependency in field.dependencies %} 
     67    document.getElementById("{{ dependency.auto_id }}").onkeyup = function() { 
     68        var e = document.getElementById("{{ field.field.auto_id }}"); 
     69        if (!e._changed) { e.value = URLify({% for innerdep in field.dependencies %}document.getElementById("{{ innerdep.auto_id }}").value{% if not forloop.last %} + ' ' + {% endif %}{% endfor %}, {{ field.field.field.max_length }}); } 
     70    } 
    4371    {% endfor %} 
    44    </fieldset> 
    4572{% endfor %} 
    46 {% block after_field_sets %}{% endblock %} 
    47 {% if change %} 
    48    {% if ordered_objects %} 
    49    <fieldset class="module"><h2>{% trans "Ordering" %}</h2> 
    50    <div class="form-row{% if form.order_.errors %} error{% endif %} "> 
    51    {% if form.order_.errors %}{{ form.order_.html_error_list }}{% endif %} 
    52    <p><label for="id_order_">{% trans "Order:" %}</label> {{ form.order_ }}</p> 
    53    </div></fieldset> 
    54    {% endif %} 
     73</script> 
    5574{% endif %} 
    56 {% for related_object in inline_related_objects %}{% edit_inline related_object %}{% endfor %} 
    57 {% block after_related_