Re: Foreign key filter question

2014-01-29 Thread Larry Martell
On Wed, Jan 29, 2014 at 5:28 PM, Will A wrote: > Try > target_name_name__icontains='foo' or update the foreign key definition. target_name__name__icontains is what was needed. Thanks. > > > > On Wed, Jan 29, 2014 at 5:08 PM, Larry Martell > wrote: >> >> I have a table that has these 2 foreign

Re: Foreign key filter question

2014-01-29 Thread Will A
Try target_name_name__icontains='foo' or update the foreign key definition. On Wed, Jan 29, 2014 at 5:08 PM, Larry Martell wrote: > I have a table that has these 2 foreign keys: > > target_name = models.ForeignKey(Target) > wafer = models.ForeignKey(Wafer) > > Both Target and Wafer are

Foreign key filter question

2014-01-29 Thread Larry Martell
I have a table that has these 2 foreign keys: target_name = models.ForeignKey(Target) wafer = models.ForeignKey(Wafer) Both Target and Wafer are defined the same: name = models.CharField(max_length=40, db_index=True, unique=True) When filtering by wafer I can do this: wafer__name__icon

Re: custom filter question

2009-03-08 Thread danbergan
On Mar 8, 7:57 pm, Alex Gaynor wrote: > On Sun, Mar 8, 2009 at 8:56 PM, danbergan wrote: > > > > > I changed the directory to "ea_app", and changed my settings.configure > > > > to: > > > > settings.configure(DEBUG=True, TEMPLATE_DEBUG=True, TEMPLATE_DIRS=("d:/ > > > > current/ea_app/tpl","c:/p

Re: custom filter question

2009-03-08 Thread Alex Gaynor
On Sun, Mar 8, 2009 at 8:56 PM, danbergan wrote: > > > > > > > > I changed the directory to "ea_app", and changed my settings.configure > > > to: > > > settings.configure(DEBUG=True, TEMPLATE_DEBUG=True, TEMPLATE_DIRS=("d:/ > > > current/ea_app/tpl","c:/python/tpl"), INSTALLED_APPS=("ea",)) > > >

Re: custom filter question

2009-03-08 Thread danbergan
> > > > I changed the directory to "ea_app", and changed my settings.configure > > to: > > settings.configure(DEBUG=True, TEMPLATE_DEBUG=True, TEMPLATE_DIRS=("d:/ > > current/ea_app/tpl","c:/python/tpl"), INSTALLED_APPS=("ea",)) > > The application name has now changed to ea_app, so you'll need to

Re: custom filter question

2009-03-08 Thread Malcolm Tredinnick
On Sun, 2009-03-08 at 17:37 -0700, danbergan wrote: [...] > > I changed the directory to "ea_app", and changed my settings.configure > to: > settings.configure(DEBUG=True, TEMPLATE_DEBUG=True, TEMPLATE_DIRS=("d:/ > current/ea_app/tpl","c:/python/tpl"), INSTALLED_APPS=("ea",)) The application nam

Re: custom filter question

2009-03-08 Thread danbergan
On Mar 8, 5:39 pm, Malcolm Tredinnick wrote: > On Sun, 2009-03-08 at 16:22 -0700, danbergan wrote: > > On Mar 8, 5:13 pm, danbergan wrote: > > > On Mar 8, 4:53 pm, Malcolm Tredinnick > > > wrote: > > > > > On Sun, 2009-03-08 at 14:11 -0700, danbergan wrote: > > > > > [...] > > > > > > I'm gues

Re: custom filter question

2009-03-08 Thread Malcolm Tredinnick
On Sun, 2009-03-08 at 16:22 -0700, danbergan wrote: > On Mar 8, 5:13 pm, danbergan wrote: > > On Mar 8, 4:53 pm, Malcolm Tredinnick > > wrote: > > > > > > > > > On Sun, 2009-03-08 at 14:11 -0700, danbergan wrote: > > > > > [...] > > > > > > I'm guessing that the problem is that, since I'm not ru

Re: custom filter question

2009-03-08 Thread danbergan
On Mar 8, 5:13 pm, danbergan wrote: > On Mar 8, 4:53 pm, Malcolm Tredinnick > wrote: > > > > > On Sun, 2009-03-08 at 14:11 -0700, danbergan wrote: > > > [...] > > > > I'm guessing that the problem is that, since I'm not running withing > > > django, I don't have anything set in "INSTALLED_APPS".

Re: custom filter question

2009-03-08 Thread danbergan
On Mar 8, 4:53 pm, Malcolm Tredinnick wrote: > On Sun, 2009-03-08 at 14:11 -0700, danbergan wrote: > > [...] > > > I'm guessing that the problem is that, since I'm not running withing > > django, I don't have anything set in "INSTALLED_APPS". > > Indeed. Template tag directories are only looked

Re: custom filter question

2009-03-08 Thread Malcolm Tredinnick
On Sun, 2009-03-08 at 14:11 -0700, danbergan wrote: [...] > I'm guessing that the problem is that, since I'm not running withing > django, I don't have anything set in "INSTALLED_APPS". Indeed. Template tag directories are only looked for in locations listed in INSTALLED_APPS. > I've tried > s

custom filter question

2009-03-08 Thread danbergan
Hello - I'm using Django templates in my custom application (outside of the Django web framework.) I'm trying to use a custom filter in my template, but I can't seem to find a way to get django to find my custom filter. Has anyone used a custom filter outside of the framework? In my template:

Re: Newbie ForeignKey Filter Question

2008-04-04 Thread Kevin Monceaux
On Fri, 4 Apr 2008, josesoa wrote: > Something like this should do the trick... > > Events.objects.filter(brags__isnull=False) Thanks!!! That pointed me in the right direction. But, it created a QuerySet where, for example, if an event had five brags five copies of the that event were inclu

Re: Newbie ForeignKey Filter Question

2008-04-04 Thread josesoa
Something like this should do the trick... Events.objects.filter(brags__isnull=False) On Apr 4, 8:01 pm, Kevin Monceaux <[EMAIL PROTECTED]> wrote: > Django Fans, > > I've tinkered around briefly off and on with Django for a while now. > Finally a few days ago I finally found one of those "Round

Newbie ForeignKey Filter Question

2008-04-04 Thread Kevin Monceaux
Django Fans, I've tinkered around briefly off and on with Django for a while now. Finally a few days ago I finally found one of those "Round Tuits" I've been looking for and started converting one of the web sites I act as webmaster for from PHP to Django. My goal at this point is just to co

Re: variable multiple filter question

2006-09-21 Thread Luis P. Mendes
DavidA escreveu: > You build up a dynamic "and" query with a term for each checked box in > the UI. Then you use that compound query to filter your model objects. > > Now that I think about it, since this is an "and" you could also do: > > def my_view(request): > query = {} > for i in

Re: variable multiple filter question

2006-09-20 Thread Malcolm Tredinnick
You've already had a couple of approaches suggested here, but I have a question... On Wed, 2006-09-20 at 19:18 +0100, Luis P. Mendes wrote: > Hi, > > I want to let a user of one application to be able to filter results in > a complex way. > > There are twelve variables, all boolean, that can be

Re: variable multiple filter question

2006-09-20 Thread Adam Endicott
You don't have to write all the filter statements at once, you can add them incrementally. I usually do this kind of thing like: var1 = request.GET.get('var1', None) var2 = request.GET.get('var2', None) var3 = request.GET.get('var3', None) object_list = MyModel.objects.all() if var1: object_l

Re: variable multiple filter question

2006-09-20 Thread DavidA
Luis P. Mendes wrote: > But if he chooses to apply five filters, there will have to be five > filter methods appended, or five key=values pairs as arguments. You can do something like this: from django.db.models import Q def my_view(request): query = Q() for i in range(1, 13):

variable multiple filter question

2006-09-20 Thread Luis P. Mendes
Hi, I want to let a user of one application to be able to filter results in a complex way. There are twelve variables, all boolean, that can be used to perform these filters. In PostgreSQL, all data for these variables are thus saved as either True of False. There is no difficulty to apply in

Re: Filter question

2006-09-06 Thread primitive
Thanks a lot guys :-), this works great. (Both suggestions from Dave and Russ), so elegant : - ). Thanks a million! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, se

Re: Filter question

2006-09-05 Thread Russell Keith-Magee
On 9/5/06, primitive <[EMAIL PROTECTED] > wrote: example codeqdict = QueryDict('id=1&fk_client_id=2')queryset = Ticket.objectsOk; so you have a GET request string 'id=1&fk_client_id=2', and you want to compose a query from it. You will be hitting against two problems:1) The 'value' for each key in

Re: Filter question

2006-09-05 Thread DavidA
primitive wrote: > Is it possible to use a string (coming from an request object) as a > keyword to filter? I keep getting errors, but I don't know how to > convert these strings into types that filter will understand. Sure, Python allows you to pass a dict as a set of keyword arguments, so you

Re: Filter question

2006-09-05 Thread primitive
example code qdict = QueryDict('id=1&fk_client_id=2') queryset = Ticket.objects for k, v in qdict.iteritems(): queryset = queryset.filter(k = v) Essentially what I want to do here, is get a list of filter keywords from an HTTP request, and then iterate through these to create the final filt

Re: Filter question

2006-09-05 Thread Russell Keith-Magee
On 9/5/06, primitive <[EMAIL PROTECTED]> wrote: Is it possible to use a string (coming from an request object) as akeyword to filter? I keep getting errors, but I don't know how toconvert these strings into types that filter will understand. Short answer; yes. request.GET is just a dictionary of or

Re: Filter question

2006-09-05 Thread Laundro
Just from the top of my head (I'm a bit bored at work). As the filter options are python scripts anyway, maybe you could integrate them in your script and call them from within the script and send the altered text to your template? Or maybe you could write your template from within the script its

Filter question

2006-09-05 Thread primitive
Good day, I am a Python and Django newbie, so bear with me if this is a silly question. Is it possible to use a string (coming from an request object) as a keyword to filter? I keep getting errors, but I don't know how to convert these strings into types that filter will understand. eg. I conve