Ticket #17881: 17881-poc.patch
File 17881-poc.patch, 2.0 KB (added by , 13 years ago) |
---|
-
django/contrib/admin/options.py
112 112 # extra HTML -- the "add other" interface -- to the end of the 113 113 # rendered output. formfield can be None if it came from a 114 114 # OneToOneField with parent_link=True or a M2M intermediary. 115 if formfield and db_field.name not in self. raw_id_fields:115 if formfield and db_field.name not in self.get_raw_id_fields(request): 116 116 related_modeladmin = self.admin_site._registry.get( 117 117 db_field.rel.to) 118 118 can_add_related = bool(related_modeladmin and … … 156 156 Get a form Field for a ForeignKey. 157 157 """ 158 158 db = kwargs.get('using') 159 if db_field.name in self. raw_id_fields:159 if db_field.name in self.get_raw_id_fields(request): 160 160 kwargs['widget'] = widgets.ForeignKeyRawIdWidget(db_field.rel, 161 161 self.admin_site, using=db) 162 162 elif db_field.name in self.radio_fields: … … 177 177 return None 178 178 db = kwargs.get('using') 179 179 180 if db_field.name in self. raw_id_fields:180 if db_field.name in self.get_raw_id_fields(request): 181 181 kwargs['widget'] = widgets.ManyToManyRawIdWidget(db_field.rel, 182 182 self.admin_site, using=db) 183 183 kwargs['help_text'] = '' … … 200 200 """ 201 201 return self.ordering or () # otherwise we might try to *None, which is bad ;) 202 202 203 def get_raw_id_fields(self, request): 204 """ 205 Hook for specifying custom raw id fields. 206 """ 207 return self.raw_id_fields 208 203 209 def get_readonly_fields(self, request, obj=None): 204 210 """ 205 211 Hook for specifying custom readonly fields.