magic-removal:Fixed breadcrumbs in admin. Removed some debug print statements

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1724 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Robert Wittams 2005-12-18 19:32:40 +00:00
parent fb66b37337
commit 938f339c82
8 changed files with 28 additions and 13 deletions

View File

@ -1,5 +1,5 @@
{% extends "admin/base_site" %}
{% load i18n admin_modify adminmedia %}
{% load i18n admin_modify adminmedia breadcrumbs %}
{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="../../../jsi18n/"></script>
{% for js in bound_manipulator.javascript_imports %}{% include_admin_script js %}{% endfor %}
@ -9,8 +9,7 @@
{% block userlinks %}<a href="../../../password_change/">{% trans 'Change password' %}</a> / <a href="../../../logout/">{% trans 'Log out' %}</a>{% endblock %}
{% block breadcrumbs %}{% if not is_popup %}
<div class="breadcrumbs">
<a href="../../../">{% trans "Home" %}</a> &rsaquo;
<a href="../../">{{ bound_manipulator.verbose_name_plural|capfirst }}</a> &rsaquo;
{% path_breadcrumbs path "Home" "1" "1" %}
{% if add %}{% trans "Add" %} {{ bound_manipulator.verbose_name }}{% else %}{{ bound_manipulator.original|striptags|truncatewords:"18" }}{% endif %}
</div>
{% endif %}{% endblock %}

View File

@ -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 %}<a href="../../password_change/">{% trans 'Change password' %}</a> / <a href="../../logout/">{% trans 'Log out' %}</a>{% endblock %}
{% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> &rsaquo; {{ cl.opts.verbose_name_plural|capfirst }} </div>{% endblock %}{% endif %}
{% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs">{% path_breadcrumbs path "Home" "1" "0" %}</div>{% endblock %}{% endif %}
{% block coltype %}flex{% endblock %}
{% block content %}
<div id="content-main">

View File

@ -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')

View File

@ -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("<a href='%s'>%s</a>&rsaquo;\n" % ( "../" * backs , label ) )
backs -= 1
return "".join(text)
path_breadcrumbs = register.simple_tag(path_breadcrumbs)

View File

@ -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)

View File

@ -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

View File

@ -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:
"""

View File

@ -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():