OneToOneField bug fixed

10 views
Skip to first unread message

Adrian Holovaty

unread,
Nov 20, 2005, 5:19:44 PM11/20/05
to django...@googlegroups.com
I've fixed the longstanding OneToOneField bug. If you're using
OneToOneFields, update your trunk code and let me know whether things
work for you!

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

plisk

unread,
Nov 21, 2005, 4:54:12 AM11/21/05
to Django users
Seems like its become broken even more, as for me with the following
model

from django.core import meta
from django.models.auth import User

class PolicyCategory(meta.Model):
name = meta.CharField(maxlength=100);

def __repr__(self):
return self.name

class META:
db_table = 'intranet_policycategories'
module_name = 'policycategories'
verbose_name_plural = 'Policy Categories'

admin = meta.Admin(
search_fields = ['name'],
)


class UserDetail(meta.Model):
user = meta.OneToOneField(User)
policy_categories = meta.ManyToManyField(PolicyCategory,
blank=True)

def __repr__(self):
return self.get_user().username

class META:
admin = meta.Admin(
search_fields = ['user'],
)

I'm getting this error when opening user details list

Request Method: GET
Request URL: http://192.168.1.156:8000/admin/intranet/userdetails/
Exception Type: ProgrammingError
Exception Value: ERROR: missing FROM-clause entry for table
"auth_users" SELECT "intranet_userdetails"."user_id" FROM
"intranet_userdetails" ORDER BY "auth_users"."username" DESC
Exception Location:
/usr/lib/python2.4/site-packages/django/core/db/base.py in execute,
line 9

And this page with user detail list worked before fix.

plisk

unread,
Nov 21, 2005, 7:43:10 AM11/21/05
to Django users
Also getting error when trying to get_list, details follow

model addition to posted above

class PolicyConfirmation(meta.Model):
policy = meta.ForeignKey(Policy)
userdetail = meta.ForeignKey(UserDetail)
date_added = meta.DateTimeField(default=meta.LazyDate())


code
from django.models.intranet import policyconfirmations
confirmed =
policyconfirmations.get_list(policy__id__exact=policy_id,

userdetail__user__id__exact=user.id)

error

Request Method: GET
Request URL:

http://plisk.dev.reliableunit.com:8000/admin/intranet/policies/7/view/
Exception Type: TypeError
Exception Value: got unexpected keyword argument
'userdetail__user__id__exact'
Exception Location:
/usr/lib/python2.4/site-packages/django/core/meta/__init__.py in
_throw_bad_kwarg_error, line 1243

This is as rev 1330.

Reply all
Reply to author
Forward
0 new messages