From fb66b3733733759f764a7d8ad6099b3c3cd34ccb Mon Sep 17 00:00:00 2001 From: Robert Wittams Date: Sun, 18 Dec 2005 09:43:53 +0000 Subject: [PATCH] Added missing original_url method to AdminBoundField git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1722 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/admin/views/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index 43033e7ba7..3c52a23dbb 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -402,6 +402,13 @@ class AdminBoundField(BoundField): def html_error_list(self): return " ".join([form_field.html_error_list() for form_field in self.form_fields if form_field.errors]) + def original_url(self): + if self.is_file_field and self.original and self.field.attname: + url_method = getattr(self.original, 'get_%s_url' % self.field.attname) + if callable(url_method): + return url_method() + return '' + class AdminBoundFieldLine(BoundFieldLine): def __init__(self, field_line, field_mapping, original): super(AdminBoundFieldLine, self).__init__(field_line, field_mapping, original, AdminBoundField)