Ticket #1113: 1113.patch
File 1113.patch, 1.5 KB (added by , 18 years ago) |
---|
-
main.py
97 97 self.mod, self.opts = _get_mod_opts(app_label, module_name) 98 98 if not request.user.has_perm(app_label + '.' + self.opts.get_change_permission()): 99 99 raise PermissionDenied 100 101 lookup_mod, lookup_opts = self.mod, self.opts 102 if self.opts.one_to_one_field: 103 lookup_mod = self.opts.one_to_one_field.rel.to.get_model_module() 104 lookup_opts = lookup_mod.Klass._meta 105 # If lookup_opts doesn't have admin set, give it the default meta.Admin(). 106 if not lookup_opts.admin: 107 lookup_opts.admin = meta.Admin() 108 109 self.lookup_mod, self.lookup_opts = lookup_mod, lookup_opts 100 110 101 self.lookup_mod, self.lookup_opts = self.mod, self.opts102 103 111 def get_search_parameters(self, request): 104 112 # Get search parameters from the query string. 105 113 try: … … 226 234 or_queries.append(meta.Q(**{'%s__icontains' % field_name: bit})) 227 235 complex_queries.append(reduce(operator.or_, or_queries)) 228 236 lookup_params['complex'] = reduce(operator.and_, complex_queries) 237 if opts.one_to_one_field: 238 lookup_params.update(opts.one_to_one_field.rel.limit_choices_to) 229 239 self.lookup_params = lookup_params 230 240 231 241 def change_list(request, app_label, module_name):