Changeset 7967
- Timestamp:
- 07/18/08 18:54:34 (1 month ago)
- Files:
-
- django/trunk/AUTHORS (modified) (10 diffs)
- django/trunk/django/conf/project_template/urls.py (modified) (2 diffs)
- django/trunk/django/contrib/admindocs (added)
- django/trunk/django/contrib/admindocs/__init__.py (moved) (moved from django/trunk/tests/regressiontests/invalid_admin_options/__init__.py)
- django/trunk/django/contrib/admindocs/urls.py (added)
- django/trunk/django/contrib/admindocs/utils.py (moved) (moved from django/trunk/django/contrib/admin/utils.py)
- django/trunk/django/contrib/admindocs/views.py (moved) (moved from django/trunk/django/contrib/admin/views/doc.py) (14 diffs)
- django/trunk/django/contrib/admin/filterspecs.py (modified) (7 diffs)
- django/trunk/django/contrib/admin/__init__.py (modified) (1 diff)
- django/trunk/django/contrib/admin/media/css/forms.css (modified) (1 diff)
- django/trunk/django/contrib/admin/media/js/admin/CollapsedFieldsets.js (modified) (1 diff)
- django/trunk/django/contrib/admin/media/js/admin/RelatedObjectLookups.js (modified) (2 diffs)
- django/trunk/django/contrib/admin/media/js/SelectFilter.js (deleted)
- django/trunk/django/contrib/admin/models.py (modified) (2 diffs)
- django/trunk/django/contrib/admin/options.py (added)
- django/trunk/django/contrib/admin/sites.py (added)
- django/trunk/django/contrib/admin/templates/admin/auth/user/add_form.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/admin/auth/user/change_password.html (modified) (4 diffs)
- django/trunk/django/contrib/admin/templates/admin/base.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/admin/change_form.html (modified) (3 diffs)
- django/trunk/django/contrib/admin/templates/admin/change_list.html (modified) (2 diffs)
- django/trunk/django/contrib/admin/templates/admin/delete_confirmation.html (modified) (2 diffs)
- django/trunk/django/contrib/admin/templates/admin_doc/index.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/admin_doc/view_index.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/admin/edit_inline (added)
- django/trunk/django/contrib/admin/templates/admin/edit_inline_stacked.html (deleted)
- django/trunk/django/contrib/admin/templates/admin/edit_inline/stacked.html (added)
- django/trunk/django/contrib/admin/templates/admin/edit_inline_tabular.html (deleted)
- django/trunk/django/contrib/admin/templates/admin/edit_inline/tabular.html (added)
- django/trunk/django/contrib/admin/templates/admin/field_line.html (deleted)
- django/trunk/django/contrib/admin/templates/admin/filters.html (deleted)
- django/trunk/django/contrib/admin/templates/admin/includes (added)
- django/trunk/django/contrib/admin/templates/admin/includes/fieldset.html (added)
- django/trunk/django/contrib/admin/templates/admin/index.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/admin/invalid_setup.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/admin/login.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/admin/object_history.html (modified) (3 diffs)
- django/trunk/django/contrib/admin/templates/admin/search_form.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/registration/password_change_done.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/registration/password_change_form.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/registration/password_reset_form.html (modified) (1 diff)
- django/trunk/django/contrib/admin/templates/widget/date_time.html (deleted)
- django/trunk/django/contrib/admin/templates/widget/default.html (deleted)
- django/trunk/django/contrib/admin/templates/widget/file.html (deleted)
- django/trunk/django/contrib/admin/templates/widget/foreign.html (deleted)
- django/trunk/django/contrib/admin/templates/widget/many_to_many.html (deleted)
- django/trunk/django/contrib/admin/templates/widget/one_to_one.html (deleted)
- django/trunk/django/contrib/admin/templatetags/adminapplist.py (deleted)
- django/trunk/django/contrib/admin/templatetags/admin_list.py (modified) (5 diffs)
- django/trunk/django/contrib/admin/templatetags/admin_modify.py (modified) (3 diffs)
- django/trunk/django/contrib/admin/urls.py (deleted)
- django/trunk/django/contrib/admin/util.py (added)
- django/trunk/django/contrib/admin/validation.py (added)
- django/trunk/django/contrib/admin/views/auth.py (deleted)
- django/trunk/django/contrib/admin/views/decorators.py (modified) (1 diff)
- django/trunk/django/contrib/admin/views/main.py (modified) (13 diffs)
- django/trunk/django/contrib/admin/widgets.py (added)
- django/trunk/django/contrib/auth/admin.py (added)
- django/trunk/django/contrib/auth/forms.py (modified) (2 diffs)
- django/trunk/django/contrib/auth/models.py (modified) (3 diffs)
- django/trunk/django/contrib/auth/tests (added)
- django/trunk/django/contrib/auth/tests/basic.py (moved) (moved from django/trunk/django/contrib/auth/tests.py) (3 diffs)
- django/trunk/django/contrib/auth/tests/forms.py (added)
- django/trunk/django/contrib/auth/tests/__init__.py (added)
- django/trunk/django/contrib/auth/views.py (modified) (5 diffs)
- django/trunk/django/contrib/comments/admin.py (added)
- django/trunk/django/contrib/comments/models.py (modified) (4 diffs)
- django/trunk/django/contrib/comments/views/comments.py (modified) (3 diffs)
- django/trunk/django/contrib/flatpages/admin.py (added)
- django/trunk/django/contrib/flatpages/models.py (modified) (1 diff)
- django/trunk/django/contrib/redirects/models.py (modified) (2 diffs)
- django/trunk/django/contrib/sites/admin.py (added)
- django/trunk/django/contrib/sites/models.py (modified) (3 diffs)
- django/trunk/django/core/management/validation.py (modified) (3 diffs)
- django/trunk/django/db/models/base.py (modified) (2 diffs)
- django/trunk/django/db/models/fields/__init__.py (modified) (6 diffs)
- django/trunk/django/db/models/fields/related.py (modified) (13 diffs)
- django/trunk/django/db/models/__init__.py (modified) (1 diff)
- django/trunk/django/db/models/manipulators.py (modified) (2 diffs)
- django/trunk/django/db/models/options.py (modified) (2 diffs)
- django/trunk/django/__init__.py (modified) (1 diff)
- django/trunk/django/newforms/formsets.py (added)
- django/trunk/django/newforms/forms.py (modified) (7 diffs)
- django/trunk/django/newforms/__init__.py (modified) (1 diff)
- django/trunk/django/newforms/models.py (modified) (7 diffs)
- django/trunk/django/newforms/widgets.py (modified) (10 diffs)
- django/trunk/docs/admin.txt (added)
- django/trunk/docs/authentication.txt (modified) (5 diffs)
- django/trunk/docs/custom_model_fields.txt (modified) (1 diff)
- django/trunk/docs/localflavor.txt (modified) (1 diff)
- django/trunk/docs/model-api.txt (modified) (7 diffs)
- django/trunk/docs/modelforms.txt (modified) (1 diff)
- django/trunk/docs/newforms.txt (modified) (2 diffs)
- django/trunk/docs/tutorial02.txt (modified) (12 diffs)
- django/trunk/tests/modeltests/invalid_models/models.py (modified) (2 diffs)
- django/trunk/tests/modeltests/model_formsets (added)
- django/trunk/tests/modeltests/model_formsets/__init__.py (copied) (copied from django/trunk/django/contrib/admin/__init__.py)
- django/trunk/tests/modeltests/model_formsets/models.py (added)
- django/trunk/tests/modeltests/model_forms/models.py (modified) (1 diff)
- django/trunk/tests/regressiontests/admin_ordering (added)
- django/trunk/tests/regressiontests/admin_ordering/__init__.py (copied) (copied from django/trunk/django/contrib/admin/__init__.py)
- django/trunk/tests/regressiontests/admin_ordering/models.py (added)
- django/trunk/tests/regressiontests/admin_views (added)
- django/trunk/tests/regressiontests/admin_views/fixtures (added)
- django/trunk/tests/regressiontests/admin_views/fixtures/admin-views-users.xml (added)
- django/trunk/tests/regressiontests/admin_views/fixtures/string-primary-key.xml (added)
- django/trunk/tests/regressiontests/admin_views/__init__.py (copied) (copied from django/trunk/django/contrib/admin/__init__.py)
- django/trunk/tests/regressiontests/admin_views/models.py (added)
- django/trunk/tests/regressiontests/admin_views/tests.py (added)
- django/trunk/tests/regressiontests/admin_views/urls.py (added)
- django/trunk/tests/regressiontests/admin_widgets (added)
- django/trunk/tests/regressiontests/admin_widgets/__init__.py (copied) (copied from django/trunk/django/contrib/admin/__init__.py)
- django/trunk/tests/regressiontests/admin_widgets/models.py (added)
- django/trunk/tests/regressiontests/forms/formsets.py (added)
- django/trunk/tests/regressiontests/forms/forms.py (modified) (1 diff)
- django/trunk/tests/regressiontests/forms/media.py (added)
- django/trunk/tests/regressiontests/forms/tests.py (modified) (2 diffs)
- django/trunk/tests/regressiontests/forms/widgets.py (modified) (6 diffs)
- django/trunk/tests/regressiontests/inline_formsets (added)
- django/trunk/tests/regressiontests/inline_formsets/__init__.py (copied) (copied from django/trunk/django/contrib/admin/__init__.py)
- django/trunk/tests/regressiontests/inline_formsets/models.py (added)
- django/trunk/tests/regressiontests/invalid_admin_options/models.py (deleted)
- django/trunk/tests/regressiontests/modeladmin (added)
- django/trunk/tests/regressiontests/modeladmin/__init__.py (copied) (copied from django/trunk/django/contrib/admin/__init__.py)
- django/trunk/tests/regressiontests/modeladmin/models.py (added)
- django/trunk/tests/templates/custom_admin (added)
- django/trunk/tests/templates/custom_admin/change_form.html (added)
- django/trunk/tests/templates/custom_admin/change_list.html (added)
- django/trunk/tests/templates/custom_admin/delete_confirmation.html (added)
- django/trunk/tests/templates/custom_admin/index.html (added)
- django/trunk/tests/templates/custom_admin/login.html (added)
- django/trunk/tests/templates/custom_admin/object_history.html (added)
- django/trunk/tests/urls.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/AUTHORS
r7908 r7967 75 75 Paul Bissex <http://e-scribe.com/> 76 76 Simon Blanchard 77 David Blewett <david@dawninglight.net> 77 78 Matt Boersma <ogghead@gmail.com> 78 79 boobsd@gmail.com … … 173 174 Thomas GÃŒttler <hv@tbz-pariv.de> 174 175 dAniel hAhler 176 hambaloney 175 177 Brian Harring <ferringb@gmail.com> 176 178 Brant Harris … … 195 197 james_027@yahoo.com 196 198 jcrasta@gmail.com 199 jdetaeye 197 200 Zak Johnson <zakj@nox.cx> 198 201 Nis JÞrgensen <nis@superlativ.dk> … … 242 245 limodou 243 246 Philip Lindborg <philip.lindborg@gmail.com> 247 Simon Litchfield <simon@quo.com.au> 244 248 Daniel Lindsley <polarcowz@gmail.com> 245 249 Trey Long <trey@ktrl.com> … … 247 251 Matt McClanahan <http://mmcc.cx/> 248 252 Martin Maney <http://www.chipy.org/Martin_Maney> 253 Petr Marhoun <petr.marhoun@gmail.com> 249 254 masonsimon+django@gmail.com 250 255 Manuzhai … … 259 264 Jason McBrayer <http://www.carcosa.net/jason/> 260 265 mccutchen@gmail.com 266 Christian Metts 261 267 michael.mcewan@gmail.com 262 268 michal@plovarna.cz … … 271 277 mrmachine <real.human@mrmachine.net> 272 278 Robin Munn <http://www.geekforgod.com/> 279 msundstr 273 280 Robert Myers <myer0052@gmail.com> 274 281 NebojÅ¡a DorÄeviÄ … … 291 298 pgross@thoughtworks.com 292 299 phaedo <http://phaedo.cx/> 300 Julien Phalip <http://www.julienphalip.com> 293 301 phil@produxion.net 294 302 phil.h.smith@gmail.com … … 299 307 Daniel Poelzleithner <http://poelzi.org/> 300 308 polpak@yahoo.com 309 Matthias Pronk <django@masida.nl> 301 310 Jyrki Pulliainen <jyrki.pulliainen@gmail.com> 302 311 Johann Queuniet <johann.queuniet@adh.naellia.eu> … … 315 324 Henrique Romano <onaiort@gmail.com> 316 325 Armin Ronacher 326 Daniel Roseman <http://roseman.org.uk/> 317 327 Brian Rosner <brosner@gmail.com> 318 328 Oliver Rutherfurd <http://rutherfurd.net/> django/trunk/django/conf/project_template/urls.py
r4265 r7967 1 1 from django.conf.urls.defaults import * 2 3 # Uncomment this for admin: 4 #from django.contrib import admin 2 5 3 6 urlpatterns = patterns('', … … 5 8 # (r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')), 6 9 10 # Uncomment this for admin docs: 11 #(r'^admin/doc/', include('django.contrib.admindocs.urls')), 12 7 13 # Uncomment this for admin: 8 # (r'^admin/', include('django.contrib.admin.urls')),14 #('^admin/(.*)', admin.site.root), 9 15 ) django/trunk/django/contrib/admindocs/views.py
r6671 r7967 6 6 from django.shortcuts import render_to_response 7 7 from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist 8 from django.http import Http404 8 from django.http import Http404, get_host 9 9 from django.core import urlresolvers 10 from django.contrib.admin import utils10 from django.contrib.admindocs import utils 11 11 from django.contrib.sites.models import Site 12 12 from django.utils.translation import ugettext as _ … … 24 24 if not utils.docutils_is_available: 25 25 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)) 27 30 doc_index = staff_member_required(doc_index) 28 31 … … 30 33 # Hack! This couples this view to the URL it lives at. 31 34 admin_root = request.path[:-len('doc/bookmarklets/')] 35 root_path = re.sub(re.escape('doc/bookmarklets/') + '$', '', request.path) 32 36 return render_to_response('admin_doc/bookmarklets.html', { 37 'root_path': root_path, 33 38 'admin_url': mark_safe("%s://%s%s" % (request.is_secure() and 'https' or 'http', request.get_host(), admin_root)), 34 39 }, context_instance=RequestContext(request)) … … 62 67 'library': tag_library, 63 68 }) 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)) 66 74 template_tag_index = staff_member_required(template_tag_index) 67 75 … … 93 101 'library': tag_library, 94 102 }) 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)) 96 108 template_filter_index = staff_member_required(template_filter_index) 97 109 … … 121 133 'url': simplify_regex(regex), 122 134 }) 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)) 124 140 view_index = staff_member_required(view_index) 125 141 … … 140 156 for key in metadata: 141 157 metadata[key] = utils.parse_rst(metadata[key], 'model', _('view:') + view) 158 root_path = re.sub(re.escape('doc/views/%s/' % view) + '$', '', request.path) 142 159 return render_to_response('admin_doc/view_detail.html', { 160 'root_path': root_path, 143 161 'name': view, 144 162 'summary': title, … … 151 169 if not utils.docutils_is_available: 152 170 return missing_docutils_page(request) 153 154 171 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)) 156 177 model_index = staff_member_required(model_index) 157 178 … … 159 180 if not utils.docutils_is_available: 160 181 return missing_docutils_page(request) 161 182 162 183 # Get the model class. 163 184 try: … … 171 192 break 172 193 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} 174 195 175 196 opts = model._meta … … 183 204 data_type = related_object_name = field.rel.to.__name__ 184 205 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) 186 207 else: 187 208 data_type = get_readable_field_data_type(field) … … 214 235 # Gather related objects 215 236 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} 217 238 accessor = rel.get_accessor_name() 218 239 fields.append({ … … 226 247 'verbose' : utils.parse_rst(_("number of %s") % verbose , 'model', _('model:') + opts.module_name), 227 248 }) 228 249 root_path = re.sub(re.escape('doc/models/%s.%s/' % (app_label, model_name)) + '$', '', request.path) 229 250 return render_to_response('admin_doc/model_detail.html', { 251 'root_path': root_path, 230 252 'name': '%s.%s' % (opts.app_label, opts.object_name), 231 253 'summary': _("Fields on %s objects") % opts.object_name, … … 253 275 'order': list(settings_mod.TEMPLATE_DIRS).index(dir), 254 276 }) 277 root_path = re.sub(re.escape('doc/templates/%s/' % template) + '$', '', request.path) 255 278 return render_to_response('admin_doc/template_detail.html', { 279 'root_path': root_path, 256 280 'name': template, 257 281 'templates': templates, django/trunk/django/contrib/admin/filterspecs.py
r6671 r7967 16 16 class FilterSpec(object): 17 17 filter_specs = [] 18 def __init__(self, f, request, params, model ):18 def __init__(self, f, request, params, model, model_admin): 19 19 self.field = f 20 20 self.params = params … … 24 24 register = classmethod(register) 25 25 26 def create(cls, f, request, params, model ):26 def create(cls, f, request, params, model, model_admin): 27 27 for test, factory in cls.filter_specs: 28 28 if test(f): 29 return factory(f, request, params, model )29 return factory(f, request, params, model, model_admin) 30 30 create = classmethod(create) 31 31 … … 53 53 54 54 class 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) 57 57 if isinstance(f, models.ManyToManyField): 58 58 self.lookup_title = f.rel.to._meta.verbose_name … … 82 82 83 83 class 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) 86 86 self.lookup_kwarg = '%s__exact' % f.name 87 87 self.lookup_val = request.GET.get(self.lookup_kwarg, None) … … 99 99 100 100 class 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) 103 103 104 104 self.field_generic = '%s__' % self.field.name … … 134 134 135 135 class 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) 138 138 self.lookup_kwarg = '%s__exact' % f.name 139 139 self.lookup_kwarg2 = '%s__isnull' % f.name … … 160 160 # more appropriate, and the AllValuesFilterSpec won't get used for it. 161 161 class 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) 164 164 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) 166 166 167 167 def title(self): django/trunk/django/contrib/admin/__init__.py
r4265 r7967 1 from django.contrib.admin.options import ModelAdmin, HORIZONTAL, VERTICAL 2 from django.contrib.admin.options import StackedInline, TabularInline 3 from django.contrib.admin.sites import AdminSite, site 4 5 def 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 59 59 .flatpages-flatpage #id_content { height:40.2em; } 60 60 .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 48 48 var divs = fs.getElementsByTagName('div'); 49 49 for (var i=0; i<divs.length; i++) { 50 if (divs[i].className.match(/\berror \b/)) {50 if (divs[i].className.match(/\berrors\b/)) { 51 51 return true; 52 52 } django/trunk/django/contrib/admin/media/js/admin/RelatedObjectLookups.js
r6691 r7967 1 // Handles related-objects functionality: lookup link for raw_id_ admin=True1 // Handles related-objects functionality: lookup link for raw_id_fields 2 2 // and Add Another links. 3 3 … … 30 30 var name = win.name.replace(/___/g, '.'); 31 31 var elem = document.getElementById(name); 32 if (elem.className.indexOf('v RawIdAdminField') != -1 && elem.value) {32 if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) { 33 33 elem.value += ',' + chosenId; 34 34 } else { django/trunk/django/contrib/admin/models.py
r6671 r7967 2 2 from django.contrib.contenttypes.models import ContentType 3 3 from django.contrib.auth.models import User 4 from django.contrib.admin.util import quote 4 5 from django.utils.translation import ugettext_lazy as _ 5 6 from django.utils.encoding import smart_unicode … … 51 52 This is relative to the Django admin index page. 52 53 """ 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 9 9 10 10 <div class="form-row"> 11 {{ form.username.html_error_list }} 11 {{ form.username.errors }} 12 {# TODO: get required class on label_tag #} 12 13 <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> 14 15 </div> 15 16 16 17 <div class="form-row"> 17 {{ form.password1.html_error_list }} 18 {{ form.password1.errors }} 19 {# TODO: get required class on label_tag #} 18 20 <label for="id_password1" class="required">{% trans 'Password' %}:</label> {{ form.password1 }} 19 21 </div> 20 22 21 23 <div class="form-row"> 22 {{ form.password2.html_error_list }} 24 {{ form.password2.errors }} 25 {# TODO: get required class on label_tag #} 23 26 <label for="id_password2" class="required">{% trans 'Password (again)' %}:</label> {{ form.password2 }} 24 27 <p class="help">{% trans 'Enter the same password as above, for verification.' %}</p> 25 28 </div> 26 29 30 <script type="text/javascript">document.getElementById("id_username").focus();</script> 31 27 32 </fieldset> 28 33 {% endblock %} django/trunk/django/contrib/admin/templates/admin/auth/user/change_password.html
r7294 r7967 3 3 {% block extrahead %}{{ block.super }} 4 4 <script type="text/javascript" src="../../../../jsi18n/"></script> 5 {% for js in javascript_imports %}{% include_admin_script js %}{% endfor %}6 5 {% endblock %} 7 6 {% block stylesheet %}{% admin_media_prefix %}css/forms.css{% endblock %} … … 19 18 <div> 20 19 {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %} 21 {% if form.error _dict%}20 {% if form.errors %} 22 21 <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 %} 24 23 </p> 25 24 {% endif %} … … 30 29 31 30 <div class="form-row"> 32 {{ form.password1.html_error_list }} 31 {{ form.password1.errors }} 32 {# TODO: get required class on label_tag #} 33 33 <label for="id_password1" class="required">{% trans 'Password' %}:</label> {{ form.password1 }} 34 34 </div> 35 35 36 36 <div class="form-row"> 37 {{ form.password2.html_error_list }} 37 {{ form.password2.errors }} 38 {# TODO: get required class on label_tag #} 38 39 <label for="id_password2" class="required">{% trans 'Password (again)' %}:</label> {{ form.password2 }} 39 40 <p class="help">{% trans 'Enter the same password as above, for verification.' %}</p> … … 46 47 </div> 47 48 48 <script type="text/javascript">document.getElementById(" {{ first_form_field_id }}").focus();</script>49 <script type="text/javascript">document.getElementById("id_password1").focus();</script> 49 50 </div> 50 51 </form></div> django/trunk/django/contrib/admin/templates/admin/base.html
r7294 r7967 23 23 </div> 24 24 {% 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> 33 26 {% endif %} 34 27 {% block nav-global %}{% endblock %} django/trunk/django/contrib/admin/templates/admin/change_form.html
r7294 r7967 1 1 {% extends "admin/base_site.html" %} 2 2 {% load i18n admin_modify adminmedia %} 3 3 4 {% block extrahead %}{{ block.super }} 4 5 <script type="text/javascript" src="../../../jsi18n/"></script> 5 { % for js in javascript_imports %}{% include_admin_script js %}{% endfor %}6 {{ media }} 6 7 {% endblock %} 8 7 9 {% block stylesheet %}{% admin_media_prefix %}css/forms.css{% endblock %} 10 8 11 {% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %} 12 9 13 {% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %} 14 10 15 {% block breadcrumbs %}{% if not is_popup %} 11 16 <div class="breadcrumbs"> … … 15 20 </div> 16 21 {% endif %}{% endblock %} 22 17 23 {% block content %}<div id="content-main"> 18 24 {% block object-tools %} … … 26 32 <div> 27 33 {% 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 %} 30 36 <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 %} 32 38 </p> 39 <ul class="errorlist">{% for error in adminform.form.non_field_errors %}<li>{{ error }}</li>{% endfor %}</ul> 33 40 {% 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 } 43 71 {% endfor %} 44 </fieldset>45 72 {% 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> 55 74 {% endif %} 56 {% for related_object in inline_related_objects %}{% edit_inline related_object %}{% endfor %} 57
