Re: Queryset of instances bound to particular ForeignKey

2007-08-03 Thread Benjamin Goldenberg

Hi Colin,
The problem is that there are multiple ForeignKeys in A bound to
instances of B, but I only want the instances of B bound to a specific
foreignkey. Does that make sense?

-Benjamin

On Aug 3, 12:17 am, Collin Grady <[EMAIL PROTECTED]> wrote:
> I feel silly for not trying this earlier, but it appears to work :)
>
> >>> B.objects.filter(a__isnull=False)
>
> [, ]
>
> Models used for this test:http://dpaste.com/15931/


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Queryset of instances bound to particular ForeignKey

2007-08-02 Thread Benjamin Goldenberg

Hi everyone,
I asked about this earlier today on IRC and no one knew of a way to do
it. Basically I have a model, let's call it ModelA with a ForeignKey
to an instance of ModelB. I would like QuerySet of all instances of
ModelB that are bound to that particular ForeignKey. Does anyone have
any idea of how to construct such a query?

Thanks,
Benjamin


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Indent Problem?

2007-07-27 Thread Benjamin Goldenberg

Hi Greg,
Make sure you are consistently using tabs or spaces for indentation.
Most people set their editors to replace a tab with four spaces. I
would recommend this configuration. Python will get confused if you
start mixing tabs and spaces.

-Benjamin

On Jul 27, 2:59 pm, Greg <[EMAIL PROTECTED]> wrote:
> I have the following view:
>
> def addpad(request):
> if request.method == 'POST':
> pads = request.session.get('pad', [])
> i = 1
> b = 1
> for a in request.POST:
> if a != '---':
> opad = RugPad.objects.get(id=b)
> s = opad.size
> p = opad.price
> pads.append({'size': s, 'price': p})
> request.session['pad'] = pads
> b  = b + 1 # This is where it says the indent
> is wrong
> return render_to_response('addpad.html', {'spad':
> request.session['pad']})
>
> However, in the second to last line 'b = b + 1' it says that the
> indent is wrong.  However, I have this the same as my indent for my if
> statement.  I though that this would be correct.  Any suggestions?
>
> Thanks


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Trouble setting up Pydev debugger

2007-07-27 Thread Benjamin Goldenberg

Hi everyone,
I'm trying to use PyDev to debug my Django project. I have followed
the instructions from Fabio:
http://pydev.blogspot.com/2006/09/configuring-pydev-to-work-with-django.html

Running the configuration he describes seems to work. It starts the
development server. However, the debugger will not start, reporting
this error:
"server timed out after 10 seconds, could not connect to localhost:
11570"

Does anyone have any suggestions on how to properly configure the
debugger?

Thanks,
Benjamin


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---