Standard example:
class Author(models.Model):
name = models.CharField(max_length=100)
class Book(models.Model):
title = models.CharField(max_length=100)
author = models.ForeignKey(Author)
#... Many other fields ...
I'd like to edit the Book
s from the Author
change page.
I tried with InlineModelAdmin but since Book
has many fields, it's not easy to edit.
That's why I tried to put links towards the children on the author/change template.
<ul>
<li><a href="{% url admin:content_scribpart_add %}">Add a Book</a></li>
{% for book in original.book_set.all %}
<li><a href="{% url admin:myapp_book_change book.id %}">Edit {{ book }}</a></li>
{% endfor %}
</ul>
But there are several questions
- How can I prepopulate the related
Author
id in theBook
form - How can I make the Save button to go back to the related
Author
- Am I on right track ?