Ticket #7984: admin-inlineviewonsite.diff

File admin-inlineviewonsite.diff, 2.5 KB (added by Julian Bez, 16 years ago)
  • django/contrib/admin/options.py

     
    773773    def __init__(self, formset, form, fieldsets, prepopulated_fields, original):
    774774        self.formset = formset
    775775        self.original = original
     776        self.original.content_type_id = ContentType.objects.get_for_model(original).id
    776777        self.show_url = original and hasattr(original, 'get_absolute_url')
    777778        super(InlineAdminForm, self).__init__(form, fieldsets, prepopulated_fields)
    778779
  • django/contrib/admin/templates/admin/edit_inline/stacked.html

     
    1010    {% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
    1111    </h2>
    1212  {% if inline_admin_form.show_url %}
    13   <p><a href="/r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a></p>
     13  <p><a href="../../../r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a></p>
    1414  {% endif %}
    1515
    1616  {% for fieldset in inline_admin_form %}
  • django/contrib/admin/templates/admin/edit_inline/tabular.html

     
    2121
    2222        <td class="original">{% if inline_admin_form.original or inline_admin_form.show_url %}<p>
    2323          {% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %}
    24           {% if inline_admin_form.show_url %}<a href="/r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a>{% endif %}
     24          {% if inline_admin_form.show_url %}<a href="../../../r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a>{% endif %}
    2525            </p>{% endif %}
    2626          {{ inline_admin_form.pk_field.field }}
    2727          {% spaceless %}
Back to Top