Thursday, January 27, 2011

Re: object has no attribute

On Thu, Jan 27, 2011 at 9:41 AM, Pacem <metapacem@gmail.com> wrote:
> Hi. Im trying to create a web-site with a book from pact.com (Django
> website development) as a basis. It has gone pretty well so far, but i
> have encountered a problem when changing a form in models.py from
> ForeingKey to OneToManyKey.

You changed it to a OneToOneKey (OneToMany is another way of saying
ForeignKey). OneToOneKey relationships are modelled as a single
attribute, not a set, so it would simply be

snarveier = bruker.brukersnarvei

Using "python manage.py shell" you can explore what attributes your
objects have. Create a user and run dir(user_instance).


Cheers

Tom

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

No comments:

Post a Comment