> Den 04/11/2014 kl. 23.07 skrev [email protected]:
> 
>  
> Hi Erik,
>  
> the idea was, that one Author can write in more than one language (eg. en and 
> de), or no one at all. This was the background to use the ManyToManyField. 

Yes, but then you simply create multiple Interest objects, right? One for every 
author-language combination. Your field names are singular, not plural, which 
tells me you should use a ForeignKey field. The current Interest model links 
multiple Authors with multiple Languages, which doesn't make much sense.

If you want to use ManyToManyField, then you put a "interests" field to 
Language directly on the Author model.

> But the "error" Message must have an other reason?

The direct cause is that you are trying to print self.author in the __str__ 
method. self.author is a ManyRelatedManager, so you should use 
self.authors.all() to access the individual authors. But you should change you 
models instead of fixing this error :-)

Erik

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/EBA3FC7E-EECC-47A7-9C4D-357F4B7295C8%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to