diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html index 7be753a52a..95a5eb6fae 100644 --- a/django/contrib/admin/templates/admin/change_form.html +++ b/django/contrib/admin/templates/admin/change_form.html @@ -1,5 +1,5 @@ {% extends "admin/base_site" %} -{% load i18n admin_modify adminmedia %} +{% load i18n admin_modify adminmedia breadcrumbs %} {% block extrahead %}{{ block.super }} {% for js in bound_manipulator.javascript_imports %}{% include_admin_script js %}{% endfor %} @@ -9,8 +9,7 @@ {% block userlinks %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} {% block breadcrumbs %}{% if not is_popup %} {% endif %}{% endblock %} diff --git a/django/contrib/admin/templates/admin/change_list.html b/django/contrib/admin/templates/admin/change_list.html index 5566a33230..4d6fe2d84d 100644 --- a/django/contrib/admin/templates/admin/change_list.html +++ b/django/contrib/admin/templates/admin/change_list.html @@ -1,8 +1,8 @@ {% extends "admin/base_site" %} -{% load adminmedia admin_list i18n %} +{% load adminmedia admin_list i18n breadcrumbs %} {% block bodyclass %}change-list{% endblock %} {% block userlinks %}{% trans 'Change password' %} / {% trans 'Log out' %}{% endblock %} -{% if not is_popup %}{% block breadcrumbs %}{% endblock %}{% endif %} +{% if not is_popup %}{% block breadcrumbs %}{% endblock %}{% endif %} {% block coltype %}flex{% endblock %} {% block content %}
diff --git a/django/contrib/admin/templatetags/admin_modify.py b/django/contrib/admin/templatetags/admin_modify.py index 9be7333f83..f3ef74d8a2 100644 --- a/django/contrib/admin/templatetags/admin_modify.py +++ b/django/contrib/admin/templatetags/admin_modify.py @@ -138,7 +138,6 @@ class StackedBoundRelatedObject(BoundRelatedObject): super(StackedBoundRelatedObject, self).__init__(related_object, field_mapping, original) fields = self.relation.editable_fields() self.field_mappings.fill() - print self.field_mappings.__dict__ self.form_field_collection_wrappers = [FormFieldCollectionWrapper(field_mapping ,fields) for field_mapping in self.field_mappings] self.show_url = original and hasattr(self.relation.opts, 'get_absolute_url') diff --git a/django/contrib/admin/templatetags/breadcrumbs.py b/django/contrib/admin/templatetags/breadcrumbs.py new file mode 100644 index 0000000000..ab4eaa083d --- /dev/null +++ b/django/contrib/admin/templatetags/breadcrumbs.py @@ -0,0 +1,16 @@ +from django.core.template import Library + +register = Library() + +def path_breadcrumbs(path, overrides="", front=0, back=0): + overs = overrides.split('/') + comps = [""] * int(front) + path.split('/')[:-1] + backs = int(back) + len(comps) + overs.extend( [None for x in range(len(overs) -1 ,len(comps)) ] ) + text = [] + for comp, ov in zip(comps,overs): + label = ov or comp + text.append("%s›\n" % ( "../" * backs , label ) ) + backs -= 1 + return "".join(text) +path_breadcrumbs = register.simple_tag(path_breadcrumbs) \ No newline at end of file diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 3c52a23dbb..05d243712c 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -304,7 +304,6 @@ class ChangeList(object): self.lookup_params = lookup_params def change_list(request, path): - print "change_list:", path try: cl = ChangeList(request, path) except IncorrectLookupParameters: @@ -313,7 +312,8 @@ def change_list(request, path): c = Context(request, { 'title': cl.title, 'is_popup': cl.is_popup, - 'cl' : cl + 'cl' : cl, + 'path': path[:path.rindex('/')] }) c.update({'has_add_permission': c['perms'][cl.app_label][cl.opts.get_add_permission()]}), return render_to_response(['admin/%s/%s/change_list' % (cl.app_label, cl.opts.object_name.lower()), @@ -531,7 +531,9 @@ def add_stage(request, path, show_delete=False, form_url='', post_url='../change 'form': form, 'is_popup': request.REQUEST.has_key('_popup'), 'show_delete': show_delete, + 'path' : path , }) + if object_id_override is not None: c['object_id'] = object_id_override @@ -630,7 +632,8 @@ def change_stage(request, path, object_id): 'form': form, 'object_id': object_id, 'original': manipulator.original_object, - 'is_popup' : request.REQUEST.has_key('_popup') + 'is_popup' : request.REQUEST.has_key('_popup'), + 'path' : path , }) return render_change_form(model,manipulator, app_label, c, change=True) diff --git a/django/core/management.py b/django/core/management.py index e3b0a4e31c..c77b5fdaa8 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -333,7 +333,7 @@ def get_sql_indexes(app): unique = f.unique and "UNIQUE " or "" output.append("CREATE %sINDEX %s_%s ON %s (%s);" % \ (unique, klass._meta.db_table, f.column, - backend.quote_name(klass._meta.db_table), backend.quote_name(f.column))) + baackend.quote_name(klass._meta.db_table), backend.quote_name(f.column))) return output get_sql_indexes.help_doc = "Prints the CREATE INDEX SQL statements for the given model module name(s)." get_sql_indexes.args = APP_ARGS diff --git a/django/db/models/__init__.py b/django/db/models/__init__.py index f874cb0516..f0ce6a45f7 100644 --- a/django/db/models/__init__.py +++ b/django/db/models/__init__.py @@ -47,7 +47,7 @@ def get_app(app_label): app_models = __import__('%s.models' % app_name , '','',['']) return app_models - raise ImproperlyConfigured, "App with label %s could not be found" % app_name + raise ImproperlyConfigured, "App with label %s could not be found" % app_labelpostgres class LazyDate: """ diff --git a/django/db/models/manipulators.py b/django/db/models/manipulators.py index 54804eeb64..64af8ff431 100644 --- a/django/db/models/manipulators.py +++ b/django/db/models/manipulators.py @@ -273,9 +273,7 @@ class ModelChangeManipulator(AutomaticManipulator): original_object = opts.get_model_module().Klass(**params) else: raise - print "calling super" super(ModelChangeManipulator, self).__init__(original_object=original_object, follow=follow) - print "Back" self.original_object = original_object if self.opts.get_ordered_objects():