Re: syncdb Issue: OneToOneField with User model from contrib.admin

2009-02-07 Thread elith...@gmail.com

Worked perfectly - thanks very much.
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



syncdb Issue: OneToOneField with User model from contrib.admin

2009-02-07 Thread elith...@gmail.com

Hi all - I'm having an issue when trying to generate my models after a
syncdb command. I know where it's failing, and almost why - but I'm
also trying to figure out the correct solution to what I'm trying to
achieve.

In my model (http://github.com/elithrar/eatsleeprepeat.net/blob/
5f63cac3dda09421882905abbb5b268569f6de1d/projects/articulate/
models.py) I have the following line:

author = models.OneToOneField(User, _('author'))

Which generates the following error:

matts-macbook:projects matt$ python manage.py syncdb
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table articulate_category
Traceback (most recent call last):
  File "manage.py", line 11, in 
execute_manager(settings)
  File "/Library/Python/2.5/site-packages/django/core/management/
__init__.py", line 347, in execute_manager
utility.execute()
  File "/Library/Python/2.5/site-packages/django/core/management/
__init__.py", line 295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Library/Python/2.5/site-packages/django/core/management/
base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/Library/Python/2.5/site-packages/django/core/management/
base.py", line 222, in execute
output = self.handle(*args, **options)
  File "/Library/Python/2.5/site-packages/django/core/management/
base.py", line 351, in handle
return self.handle_noargs(**options)
  File "/Library/Python/2.5/site-packages/django/core/management/
commands/syncdb.py", line 66, in handle_noargs
sql, references = connection.creation.sql_create_model(model,
self.style, seen_models)
  File "/Library/Python/2.5/site-packages/django/db/backends/
creation.py", line 41, in sql_create_model
col_type = f.db_type()
  File "/Library/Python/2.5/site-packages/django/db/models/fields/
related.py", line 713, in db_type
rel_field = self.rel.get_related_field()
  File "/Library/Python/2.5/site-packages/django/db/models/fields/
related.py", line 606, in get_related_field
data = self.to._meta.get_field_by_name(self.field_name)
  File "/Library/Python/2.5/site-packages/django/db/models/
options.py", line 284, in get_field_by_name
% (self.object_name, name))
django.db.models.fields.FieldDoesNotExist: User has no field named


I have from django.contrib.auth.models import User as an import, of
course - but in short, I'd just like to define the author field in my
Article model as having a direct relationship with the User model from
contrib.admin. I don't need to extend it at all, as for this project
the User model already has the fields I need.


--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---