Ticket #9053: admin_allow_callable_on_shorting.patch
File admin_allow_callable_on_shorting.patch, 1.0 KB (added by , 16 years ago) |
---|
-
django/contrib/admin/views/main.py
155 155 f = lookup_opts.get_field(field_name) 156 156 except models.FieldDoesNotExist: 157 157 # See whether field_name is a name of a non-field 158 # that allows sorting. 158 # that allows sorting. field_name can either be 159 # a callable function or a attribute name on the 160 # model. 159 161 try: 160 attr = getattr(self.model, field_name) 162 if callable(field_name): 163 attr = field_name 164 else: 165 attr = getattr(self.model, field_name) 161 166 order_field = attr.admin_order_field 162 167 except AttributeError: 163 168 pass