Ticket #2856: t2856.diff

File t2856.diff, 1.5 KB (added by Dennis Kaarsemaker, 15 years ago)

Backwards compatible patch

  • django/contrib/admin/templates/admin/index.html

     
    6363                {% if entry.is_deletion %}
    6464                    {{ entry.object_repr }}
    6565                {% else %}
    66                     <a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
     66                    {% if entry.edited_object_still_exists %}
     67                        <a href="{{ entry.get_admin_url }}">{{ entry.object_repr }}</a>
     68                    {% else %}
     69                        {{ entry.object_repr }}
     70                    {% endif %}
    6771                {% endif %}
    6872                <br/>
    6973                {% if entry.content_type %}
  • django/contrib/admin/models.py

     
    5252        This is relative to the Django admin index page.
    5353        """
    5454        return mark_safe(u"%s/%s/%s/" % (self.content_type.app_label, self.content_type.model, quote(self.object_id)))
     55
     56    def edited_object_still_exists(self):
     57        "Check whether the edited object has been removed by a subsequent action"
     58        try:
     59            self.content_type.get_object_for_this_type(pk=self.object_id)
     60            return True
     61        except Exception:
     62            return False
Back to Top