Changeset 8474
- Timestamp:
- 08/22/08 23:00:15 (11 months ago)
- Files:
-
- django/trunk/AUTHORS (modified) (1 diff)
- django/trunk/django/contrib/admin/media/css/global.css (modified) (1 diff)
- django/trunk/django/contrib/admin/options.py (modified) (4 diffs)
- django/trunk/django/contrib/admin/sites.py (modified) (3 diffs)
- django/trunk/django/contrib/admin/templates/admin/app_index.html (added)
- django/trunk/django/contrib/admin/templates/admin/change_form.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/admin/change_list.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/admin/delete_confirmation.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/admin/index.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/AUTHORS
r8467 r8474 208 208 Michael Josephson <http://www.sdjournal.com/> 209 209 jpellerin@gmail.com 210 juliae 210 211 junzhang.jn@gmail.com 211 212 Antti Kaihola <http://akaihola.blogspot.com/> django/trunk/django/contrib/admin/media/css/global.css
r8240 r8474 5 5 a:hover { color: #036; } 6 6 a img { border:none; } 7 a.section:link, a.section:visited { color: white; text-decoration:none; } 7 8 8 9 /* GLOBAL DEFAULTS */ django/trunk/django/contrib/admin/options.py
r8469 r8474 523 523 'errors': helpers.AdminErrorList(form, formsets), 524 524 'root_path': self.admin_site.root_path, 525 'app_label': app_label, 525 526 } 526 527 context.update(extra_context or {}) … … 601 602 'errors': helpers.AdminErrorList(form, formsets), 602 603 'root_path': self.admin_site.root_path, 604 'app_label': app_label, 603 605 } 604 606 context.update(extra_context or {}) … … 632 634 'has_add_permission': self.has_add_permission(request), 633 635 'root_path': self.admin_site.root_path, 636 'app_label': app_label, 634 637 } 635 638 context.update(extra_context or {}) … … 686 689 "opts": opts, 687 690 "root_path": self.admin_site.root_path, 691 "app_label": app_label, 688 692 } 689 693 context.update(extra_context or {}) django/trunk/django/contrib/admin/sites.py
r8473 r8474 171 171 if '/' in url: 172 172 return self.model_page(request, *url.split('/', 2)) 173 else: 174 return self.app_index(request, url) 173 175 174 176 raise http.Http404('The requested admin page does not exist.') … … 316 318 app_dict[app_label] = { 317 319 'name': app_label.title(), 320 'app_url': app_label, 318 321 'has_module_perms': has_module_perms, 319 322 'models': [model_dict], … … 361 364 context_instance=template.RequestContext(request) 362 365 ) 363 366 367 def app_index(self, request, app_label): 368 user = request.user 369 has_module_perms = user.has_module_perms(app_label) 370 app_dict = {} 371 for model, model_admin in self._registry.items(): 372 if app_label == model._meta.app_label: 373 if has_module_perms: 374 perms = { 375 'add': user.has_perm("%s.%s" % (app_label, model._meta.get_add_permission())), 376 'change': user.has_perm("%s.%s" % (app_label, model._meta.get_change_permission())), 377 'delete': user.has_perm("%s.%s" % (app_label, model._meta.get_delete_permission())), 378 } 379 # Check whether user has any perm for this module. 380 # If so, add the module to the model_list. 381 if True in perms.values(): 382 model_dict = { 383 'name': capfirst(model._meta.verbose_name_plural), 384 'admin_url': '%s/' % model.__name__.lower(), 385 'perms': perms, 386 } 387 if app_dict: 388 app_dict['models'].append(model_dict), 389 else: 390 app_dict = { 391 'name': app_label.title(), 392 'app_url': '', 393 'has_module_perms': has_module_perms, 394 'models': [model_dict], 395 } 396 if not app_dict: 397 raise http.Http404('The requested admin page does not exist.') 398 # Sort the models alphabetically within each app. 399 app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name'])) 400 return render_to_response('admin/app_index.html', { 401 'title': _('%s administration' % capfirst(app_label)), 402 'app_list': [app_dict] 403 }, context_instance=template.RequestContext(request)) 364 404 365 405 # This global object represents the default admin site, for the common case. django/trunk/django/contrib/admin/templates/admin/change_form.html
r8385 r8474 16 16 <div class="breadcrumbs"> 17 17 <a href="../../../">{% trans "Home" %}</a> › 18 <a href="../../">{{ app_label|capfirst|escape }}</a> › 18 19 <a href="../">{{ opts.verbose_name_plural|capfirst }}</a> › 19 20 {% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %} django/trunk/django/contrib/admin/templates/admin/change_list.html
r7967 r8474 6 6 {% block bodyclass %}change-list{% endblock %} 7 7 8 {% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> › {{ cl.opts.verbose_name_plural|capfirst|escape }}</div>{% endblock %}{% endif %}8 {% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> › <a href="../">{{ app_label|capfirst|escape }}</a> › {{ cl.opts.verbose_name_plural|capfirst|escape }}</div>{% endblock %}{% endif %} 9 9 10 10 {% block coltype %}flex{% endblock %} django/trunk/django/contrib/admin/templates/admin/delete_confirmation.html
r7967 r8474 5 5 <div class="breadcrumbs"> 6 6 <a href="../../../../">{% trans "Home" %}</a> › 7 <a href="../../../">{{ app_label|capfirst|escape }}</a> › 7 8 <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> › 8 9 <a href="../">{{ object|escape|truncatewords:"18" }}</a> › django/trunk/django/contrib/admin/templates/admin/index.html
r7967 r8474 17 17 <div class="module"> 18 18 <table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}"> 19 <caption> {% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</caption>19 <caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption> 20 20 {% for model in app.models %} 21 21 <tr>
