Opened 15 years ago
Last modified 15 years ago
#11472 closed
Users not spanning relationship lookups — at Initial Version
Reported by: | Streamweaver | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.0 |
Severity: | Keywords: | relationships | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
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(projectownerisnull=True, releaseownerisnull=True).distinct()
it returns an error of "no such column: U1.owner_id"
Alternatively when I try:
u = User.objects.filter(projectownerisnull=False).distinct() | User.objects.filter(projectownerisnull=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.