Hi,
I am trying to add a filtering functionality to my web application. I
create a WHERE clouse text in the client side as text and post it to
the server.

My Django modele lookes like this:
class Projects(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.TextField()
    class Meta:
        db_table = 'projects'

class Timesheet(models.Model):
    ts_id = models.AutoField(primary_key=True)
    user = models.ForeignKey(Users, db_column='ts_user',
related_name='ts_user_child')
    project = models.ForeignKey(Projects, db_column='project',
related_name='project_child', null='true')
    class Meta:
        db_table = 'timesheet'

I use the following in my Django view to retrieve the data according
to the filtering argument received:
filter_str = request.POST['filter_str']
#filter_str contains something like this:  "project__name = 'Django
supported web app'"
Timesheet.objects.filter(user = id).extra(where = [filter_str])

But it gives me the error:

column "project__name" does not exist

Without using extra the same query works fine so the column does
exist. Please let me know what I am doing wrong.
Any help is greatly appreciated.

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

Reply via email to