﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15517	Admin search_field prefixes conflict with db.models.get_field_by_name	Fabian Büchler	nobody	"This issue might be related to #15203 and to the changeset r3601.


In the Django admin, the {{{ModelAdmin.search_fields}}} prefixes ({{{^, =, @}}}) are converted to {{{__istartswith, __iexact and __search}}} respectively in line 258 in {{{django.contrib.admin.views.main}}}:

{{{
    or_queries = [models.Q(**{construct_search(str(field_name)): bit}) for field_name in self.search_fields]
}}}

A few lines below in line 263 the field names are passed to {{{django.db.models.options.Options.get_field_by_name}}} without stripping the search prefixes first:

{{{
    f = self.lookup_opts.get_field_by_name(field_name)[0]
}}}

This results in {{{FieldNotFound}}} errors like ""Event has no field named '=slug'"".

I've attached a working patch."		closed	contrib.admin	1.3-beta		fixed	blocker, search_fields, changelist		Accepted	1	0	0	0	0	0
