Commits

Stephan Jaekel committed dd06b47

changed exception, raise attributeerror if method not found and added i18n

  • Participants
  • Parent commits 77161cc

Comments (0)

Files changed (1)

File django_readonlywidget/widgets.py

 from django import forms
 from django.utils.safestring import mark_safe
 from django.utils.encoding import force_unicode
+from django.utils.translation import ugettext as _
 from django.utils.html import escape, conditional_escape
 from django.contrib.admin.templatetags.admin_list import _boolean_icon
 
             except Exception,e:
                 output = e
         else:
-            raise Exception('%s is not supported by ReadOnlyWidget.' % field_type)
+            raise AttributeError('%s is not supported by ReadOnlyWidget.' % field_type)
 
         return self.render_output(field_name, field_value, output)
 
 
     def get_filefield_value(self, field_name, value):
         if value:
-            return '%s <a target="_blank" href="%s">%s</a>' % ('Currently:', value.url, value.name)
+            return '%s <a target="_blank" href="%s">%s</a>' % (_('Currently:'), value.url, value.name)
         else:
             return ''