magic-removal: Continued simplification of AdminBoundManipulator -- Removed has_absolute_url attribute

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-01-21 04:36:35 +00:00
parent f99dd1d542
commit 92d2b01a44
2 changed files with 3 additions and 3 deletions

View File

@ -11,13 +11,13 @@
<div class="breadcrumbs">
<a href="../../../">{% trans "Home" %}</a> &rsaquo;
<a href="../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo;
{% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ bound_manipulator.original|striptags|truncatewords:"18" }}{% endif %}
{% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|striptags|truncatewords:"18" }}{% endif %}
</div>
{% endif %}{% endblock %}
{% block content %}<div id="content-main">
{% if change %}{% if not is_popup %}
<ul class="object-tools"><li><a href="history/" class="historylink">{% trans "History" %}</a></li>
{% if bound_manipulator.has_absolute_url %}<li><a href="/r/{{ opts.get_content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
{% if has_absolute_url %}<li><a href="/r/{{ opts.get_content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
</ul>
{% endif %}{% endif %}
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post">{% block form_top %}{% endblock %}

View File

@ -152,7 +152,6 @@ class AdminBoundManipulator(BoundManipulator):
self.auto_populated_fields = [f for f in self.opts.fields if f.prepopulate_from]
self.javascript_imports = get_javascript_imports(self.opts, self.auto_populated_fields, field_sets);
self.has_absolute_url = hasattr(model, 'get_absolute_url')
self.first_form_field_id = self.bound_field_sets[0].bound_field_lines[0].bound_fields[0].form_fields[0].get_id();
self.ordered_object_pk_names = [o.pk.name for o in self.opts.get_ordered_objects()]
@ -171,6 +170,7 @@ def render_change_form(model, manipulator, context, add=False, change=False, for
'bound_manipulator': AdminBoundManipulator(model, manipulator, context['form']),
'has_delete_permission': context['perms'][app_label][opts.get_delete_permission()],
'has_file_field': opts.has_field_type(models.FileField),
'has_absolute_url': hasattr(model, 'get_absolute_url'),
'form_url': form_url,
'opts': opts,
}