#26607: Add a hook to customize the admin's formsets parameters
-------------------------------------+-------------------------------------
     Reporter:  David Sanders        |                    Owner:  Manav
                                     |  Agarwal
         Type:  New feature          |                   Status:  assigned
    Component:  contrib.admin        |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  admin inline         |             Triage Stage:  Accepted
  formset initial                    |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Manav Agarwal):

 Considering the model and admin as defined below.
 **models.py**

 {{{
 class Author(models.Model):
     name = models.CharField(max_length=100)


 class Book(models.Model):
     author = models.ForeignKey(Author, on_delete=models.CASCADE)
     name = models.CharField(max_length=100)
 }}}
 **admin.py**

 {{{
 class BookInline(admin.StackedInline):
     model = Book
 class AuthorAdmin(admin.ModelAdmin):
     inlines = [
         BookInline,
     ]

 admin.site.register(Author, AuthorAdmin)
 }}}

 Is it a good idea to pass the initial vales of bookinline fields by using
 get request in such a way like
 {{{
 
http://127.0.0.1:8000/admin/polls/author/add/?name=Author_name&book_1_name=book1_name_value&book_2_name=book2_name_value
 }}}
 **Example:**
 {{{
 
http://127.0.0.1:8000/admin/polls/author/add/?name=william_shakespeare&book_1_name=Hamlet&book_2_name=Romeo_and_Juliet
 }}}
 Please update me if the idea seems fine so that I may create a PR in order
 to solve the issue.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.5ce8ad44c6c8eef04f611e1083bfc6d2%40djangoproject.com.

Reply via email to