Hi,
I'm Germano from Italy. I'm new of django.
Probably this discussion has many many examples, but I can't find
my situation.
I have two models, Book and Chapters.
These are simple models, I need them only for educational purpose.
class Book(models.Model):
title=models.CharField(max_length=250)
chapters = models.ManyToManyField('Chapters')
class Chapters(models.Model):
title_of_chapter = models.CharField(max_length=250)
text=models.TextField()
Now, in admin interface I can add chapters on a new book and it works fine.
So, whdn I try to add a second book I can see chapters of book I added
previously.
When I add a new book I want see only chapter of this book. List must be
empty if I'm adding a new book.
It's very simple, but I can't find a way to make it working.
I tried somethings, such as
chapters=
models.ManyToManyField('Chapters',limit_choices_to=Q('book__title'=title))
But this not works.
I know Chapters has book_set, that is the set of references for a chapter.
There is a way to make it working?
--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/2f104d64-50f4-433b-a764-be29d9a77f0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.