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__icontains='fabri')
[<Actividad: Fabricante>]

dyn_key = '%s__icontains' % 'nombre'
kwargs = {} # a dictionary
kwargs[dyn_key] = 'fabri'  # the value to the key

kwargs
{'nombre__icontains': 'fabri'}

Actividad.objects.filter(**kwargs)
[<Actividad: Fabricante>]


Hope it helps.

Regards,
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]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to