Hi,
Unfortunately I have not found any Intel at the django documentation, in the Getting Started With Django book or the Two Scoops of Django book. So I hope someone in the community will sacrifice his nerves and time, and gives me a hint / explanation of my misunderstanding.
I have the following classes / models in my models.py:
class Author(models.Model):
author= models.CharField(max_length=255, verbose_name="Author name")
def __str__(self):
return self.author
class Language(models.Model):
ENGLISH = 'en'
GERMAN = 'de'
FRENCH = 'fr'
NOT_AVAILABLE = ''
LANGUAGE_CHOICES = (
(ENGLISH, 'English'),
(GERMAN, 'German'),
(FRENCH, 'French'),
(NOT_AVAILABLE, ''),
)
language = models.CharField(max_length=32,choices=LANGUAGE_CHOICES,default=NOT_AVAILABLE)
def __str__(self):
return self.language
class User(models.Model):
user_name = models.CharField(max_length=128, verbose_name="Username")
user_email = models.EmailField(verbose_name="User E-Mail address")
interests = models.ManyToManyField(Interest, verbose_name="User interessts")
def __str__(self):
return ' '.join([
self.user_name,
self.user_email])
class Interest(models.Model):
author = models.ManyToManyField(Author, verbose_name="Author name")
language = models.ManyToManyField(Language, verbose_name="Book language", blank=True)
def __str__(self):
return ' '.join([
self.author,
self.language])
Now I try to add some User with an Interest using the Admin module or the Shell to find out how to do that (real syntax and model) by the “site”. But unfortunately both the shell and furthermore the graphical admin module give me an error, whenever I try to add the data to an user.
Where is my error? What do I miss? My idea is, that every User has (many) Interests and an Interest is defined by an Author who he likes as well as a “possible” language in which he writes.
So hopefully someone seas my probably basic-error very fast!
Thank you very much!
Mike
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/trinity-505e6d99-93e8-4e71-98da-c0de02ff93a8-1415095074268%403capp-gmx-bs71.
For more options, visit https://groups.google.com/d/optout.