Dynamic query with Foreign Key

2013-10-30 Thread Domagoj Kovač
Hi guys, I have a question. I have a a code like this: where model_object is an instance of an Model. for field in model_object._meta.fields: field_type = type(field) if field_type is not AutoField and \ field.name != "created" and \

Re: Dynamic Query (PS)

2007-11-01 Thread Tim Chase
>> Depending on the checkbox selection it might produce a sql string >> like: >> SELECT user_id FROM Bio WHERE (race='A' OR race='W' OR race='H') AND >> (eye_color='B' OR eye_color='G' OR eye_color='H') AND (hair_color='W' >> OR hair_color='B') Though my solution would be logically about the same

Re: Dynamic Query

2007-11-01 Thread Tim Chase
> class Bio(models.Model): > HEIGHT_CHOICES = ( > ('A',"< 5' (< 152cm)") [snip] > ,('Z',"7' 0'' (213cm)") > ,('*',"> 7'' (> 213cm)") > ) > WEIGHT_CHOICES = (('A',"<100lbs (<45kg)"),('B',"100lbs (45kg)")

Dynamic Query

2007-11-01 Thread weissblitz
I'm developing my first Django website where the users should be able to search other user profiles based on certain paramaters like race, age, gender, height, weight, eye color, hair color, etc This is how my model looks: (code have been shortened to only include the pertinent sections) cl

Re: Dynamic query building

2007-04-03 Thread Malcolm Tredinnick
On Tue, 2007-04-03 at 09:32 +0200, Atilla wrote: > On 03/04/07, Honza Král <[EMAIL PROTECTED]> wrote: > > something like this works for me... > > > > q = Q( tag__name=first_tag ) > > for tag in other_tags: > > q = q | Q( tag__name=tag ) > > What kind of query does this build BTW? Is it smart en

Re: Dynamic query building

2007-04-03 Thread Atilla
On 03/04/07, Honza Král <[EMAIL PROTECTED]> wrote: > something like this works for me... > > q = Q( tag__name=first_tag ) > for tag in other_tags: > q = q | Q( tag__name=tag ) What kind of query does this build BTW? Is it smart enough to put them all into a "WHERE name IN ( all-your-tags-here) ?

Re: Dynamic query building

2007-04-02 Thread Honza Král
something like this works for me... q = Q( tag__name=first_tag ) for tag in other_tags: q = q | Q( tag__name=tag ) Model.objects.filter( q ) On 4/2/07, Christian Hoppner <[EMAIL PROTECTED]> wrote: > > Hi there! > > I've been thinking about including in my new app a kind of tag browser. The > u

Dynamic query building

2007-04-02 Thread Christian Hoppner
Hi there! I've been thinking about including in my new app a kind of tag browser. The url is meant to be in the form of tags/A+B+C. Of course I know I can use OR queries for this kind of stuff... When the query string is constructed manually (as a string), I could simply get the tags from the

Re: dynamic query key asignment

2007-01-19 Thread kamil
gracias Jorge --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED]

Re: dynamic query key asignment

2006-12-23 Thread Jorge Gajon
Hi there k1000, On 12/21/06, k1000 <[EMAIL PROTECTED]> wrote: Is there any way to create dynamically key ( 'thiskey_exact' ) in query object. eg: Object.objects.filter(thiskey_exact = 'something') I'll paste here an example from one project I have here: Actividad.objects.filter(nombre_

dynamic query key asignment

2006-12-23 Thread k1000
Is there any way to create dynamically key ( 'thiskey_exact' ) in query object. eg: Object.objects.filter(thiskey_exact = 'something') Thanx. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group