I have a patch: it was a while ago, but I was about to dig it up again. In the meantime, there is an open ticket - I think my patch is attached.
Matt On Apr 20, 10:49 am, Spaceman Paul <linkjugg...@gmail.com> wrote: > I'm looking at extending the django admin app for a project, as it > does about 96% of what we need straight out of the box. The main > feature not offered is what might be called nested modelforms. > > Stretching the example from the InlineModelAdmin documentation (which > does almost the exact opposite of what I want), suppose we have the > following models: > > class Author(models.Model): > name = models.CharField(max_length=100) > > class Book(models.Model): > author = models.ForeignKey(Author) > title = models.CharField(max_length=100) > > Suppose also that I don't want to reuse Authors between books. In > this trivial example, I would simply merge the Author field into the > Book Model: > > class Book(models.Model): > author = models.ForeignKey(Author) > title = models.CharField(max_length=100) > author_name = models.CharField(max_length=100) > > But in a more complex situation, I might want to keep the Author > fields in a separate table either simply for organisational reasons, > or because a Book might have multiple types of Authors: > > class Book(models.Model): > original_author = models.ForeignKey(Author) > abridging_author = models.ForeignKey(Author) > translating_author = models.ForeignKey(Author) > title = models.CharField(max_length=100) > > But still, I want to be able to make all fields to appear in a single > admin form per book, without a separate view for handling authors. I > picture it as working something like this: > > class AuthorAdmin(admin.NestedModelAdmin): > pass > > class BookAdmin(admin.ModelAdmin): > nested_forms = [ ('original_author', AuthorAdmin), > ('abridging_author', AuthorAdmin), > ('translating_author', AuthorAdmin), > ] > admin.site.register(Book, BookAdmin) > > My questions: > > 1) Is there some feature in the admin application that already does > this that I have overlooked? > 2) Does anybody already have a patch that does something similar? > > Assuming the answer to both the above is "no", I'm prepared to dive in > and implement it myself (the admin code looks reasonably clean and > well structured). Assuming I do implement it myself: > > 3) Are there any subtle gotchas in the admin code I should be aware of > before I start? > 4) Any suggestions of more elegant designs would be appreciated. > 5) Is there anybody else in Django land who would be interested in > this sort of functionality? Would the admin maintainers have any > technical or ideological reasons for rejecting a patch to implement > this if I submitted one? > > Regards, > > Paul. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.