#11472: Users not spanning relationship lookups
---------------------------------------------------+------------------------
          Reporter:  Streamweaver                  |         Owner:  nobody     
  
            Status:  new                           |     Milestone:             
  
         Component:  Database layer (models, ORM)  |       Version:  1.0        
  
        Resolution:                                |      Keywords:  
relationships
             Stage:  Unreviewed                    |     Has_patch:  0          
  
        Needs_docs:  0                             |   Needs_tests:  0          
  
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Old description:

> I believe there may be a bug related to relationship spanning as relates
> to User models.
>
> I'm using python 2.6 and Django 1.0.2 and this is consistant across
> Window and Linux installs.
>
> I have to Models both with relationships to Users, cutting down to
> relavant parts:
>
> class Project(models.Model):
>     owner = models.ForeignKey(User)
>
> class Release(models.Model):
>      owner = models.ForeignKey(User)
>
> In my view methods when I use:
>
> u = User.objects.exclude(project__owner__isnull=True,
> release__owner__isnull=True).distinct()
>
> it returns an error of "no such column: U1.owner_id"
>
> Alternatively when I try:
>
> u = User.objects.filter(project__owner__isnull=False).distinct() |
> User.objects.filter(project__owner__isnull=False).distinct()
>
> This returns a list of ALL  users regardless being an owner of a project
> or release.  Using either of those queries alone also returns all users.
>
> I've checked and checked and this is setup as documented and I believe is
> a bug.  I asked on Django-Users, they believe this is a bug as well.

New description:

 I believe there may be a bug related to relationship spanning as relates
 to User models.

 I'm using python 2.6 and Django 1.0.2 and this is consistant across Window
 and Linux installs.

 I have to Models both with relationships to Users, cutting down to
 relavant parts:
 {{{
 class Project(models.Model):
     owner = models.ForeignKey(User)

 class Release(models.Model):
      owner = models.ForeignKey(User)
 }}}
 In my view methods when I use:
 {{{
 u = User.objects.exclude(project__owner__isnull=True,
 release__owner__isnull=True).distinct()
 }}}
 it returns an error of "no such column: U1.owner_id"

 Alternatively when I try:
 {{{
 u = User.objects.filter(project__owner__isnull=False).distinct() |
 User.objects.filter(project__owner__isnull=False).distinct()
 }}}
 This returns a list of ALL  users regardless being an owner of a project
 or release.  Using either of those queries alone also returns all users.

 I've checked and checked and this is setup as documented and I believe is
 a bug.  I asked on Django-Users, they believe this is a bug as well.

Comment (by ramiro):

 (reformatted description)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11472#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to