Re: Searching on a calculated value

2006-05-25 Thread Gary Wilson
Adrian Holovaty wrote: > You're best off searching by the exact fields rather than messing with > derived fields. Would you offer some insight please? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Searching on a calculated value

2006-05-25 Thread Adrian Holovaty
On 5/25/06, Gary Wilson <[EMAIL PROTECTED]> wrote: > Yes, I would like to provide my users with a single search box where > they could enter a first name, a last name, or a first name and last > name. So maybe... > > if one word entered: > search in last name OR first name > elif two words en

Re: Searching on a calculated value

2006-05-25 Thread Luke Plant
Gary Wilson wrote: > Am I correct that it is good database-design practice to not store > derived or calculated fields in your database (e.g. full_name when you > have first_name and last_name)? How then do you go about querying a > derived field? I believe that people often use 'indexed views

Re: Searching on a calculated value

2006-05-24 Thread Gary Wilson
Adrian Holovaty wrote: > On 5/23/06, Gary Wilson <[EMAIL PROTECTED]> wrote: > > Yes, I guess I could split the text entered and then do a search for > > each word in both first_name and last_name like the admin interface > > does... just seems like this would return many more results than wanted >

Re: Searching on a calculated value

2006-05-23 Thread Adrian Holovaty
On 5/23/06, Gary Wilson <[EMAIL PROTECTED]> wrote: > Yes, I guess I could split the text entered and then do a search for > each word in both first_name and last_name like the admin interface > does... just seems like this would return many more results than wanted > with a large user group. It w

Re: Searching on a calculated value

2006-05-23 Thread Gary Wilson
Waylan Limberg wrote: > For an example of how the admin app does this see search_fields > http://www.djangoproject.com/documentation/model_api/#search-fields > > -- > > Waylan Limberg > [EMAIL PROTECTED] Yes, I guess I could split the text entered and then do a search for each word in both f

Re: Searching on a calculated value

2006-05-23 Thread Waylan Limberg
For an example of how the admin app does this see search_fields http://www.djangoproject.com/documentation/model_api/#search-fields On 5/23/06, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > > Hi Gary, > > On Mon, 2006-05-22 at 21:20 -0700, Gary Wilson wrote: > > I have a model similar to: > > =

Searching on a calculated value

2006-05-23 Thread Gary Wilson
I have a model similar to: === class User: first_name = CharField() last_name = CharField() def get_full_name(self): return "%s %s" % (self.first_name, self.last_name) === Is there a way I can search by full name (without storing the calculated

Re: Searching on a calculated value

2006-05-23 Thread Malcolm Tredinnick
Hi Gary, On Mon, 2006-05-22 at 21:20 -0700, Gary Wilson wrote: > I have a model similar to: > === > class User: > first_name = CharField() > last_name = CharField() > >def get_full_name(self): > return "%s %s" % (self.first_name, self.last_name) > ===