On 3/29/06, layik <[EMAIL PROTECTED]> wrote:
>
> Hello there,
>
> sorry to bother you.
>
> I was wondering if you have solved your OneToOne problem. if so could
> let me know how I could solve it as well??
> thanks
>
>
> ChaosKCW wrote:
> > Agreeded, I am trying to use OneToOne in MR branch and get the same
> > problems.
> >
> > I have:
> >
> > class Employee(models.Model):
> >    user = models.OneToOneField(User, verbose_name='Employees User ID')
> >    ...
> >
> > And get the following error when trying to view the object in admin:
> >
> > Request Method:       GET
> > Request URL:  http://127.0.0.1:8000/admin/traininglog/employee/
> > Exception Type:       OperationalError
> > Exception Value:      no such column: auth_user.username
> > Exception Location:
> >       
> > c:\programming\python24\lib\site-packages\django-0.91-py2.4.egg\django\db\backends\sqlite3\base.py
> > in execute, line 62
> >
> > Any Ideas ?

If you specify ordering, this should be fixed... kinda. Django is
trying to sort on a column in the auth_users table, but it doesn't
join to that table for some reason.

class MyClass(models.Model)
    user = OneToOneField(User)

    class Admin:
        ordering = ('user_id',)

This will force the admin system to order by the user_id column of the
myclass table. Unfortunately, this will cause a validation error when
you run any manage.py commands, but manage.py runserver will still
work. You can temporarily comment it out when running syncdb.

If someone would file a ticket for this (if they haven't already) that
would be great. I'll look at it in a few days if no one else has. I'm
trying to wrap up some other project this week.

Joseph

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

Reply via email to