--
Ticket URL: <https://code.djangoproject.com/ticket/26607>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:1>
* needs_better_patch: 0 => 1
Comment:
Currently the PR has merge conflicts
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:2>
Comment (by Tim Graham):
I think we should add a more general customization hook that allows
customizing the parameters passed to the
[https://github.com/django/django/blob/92323d54fd6df077dc523c423c7bb2dd8dbde621/django/contrib/admin/options.py#L1821
formset initialization] (which includes initial data). That could also
allow the use case of #27240 which requires adding `form_kwargs':
{'request': request}` to `formset_params`.
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:3>
* owner: nobody => (none)
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:4>
* owner: (none) => Manav Agarwal
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:5>
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>
* needs_better_patch: 1 => 0
* needs_tests: 0 => 1
* needs_docs: 0 => 1
Comment:
[https://github.com/django/django/pull/13722 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:7>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:8>
* needs_docs: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:9>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:10>
* needs_docs: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:11>
* needs_docs: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:12>
* needs_better_patch: 0 => 1
Comment:
Per Nick's comments.
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:13>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:14>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:15>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"3119a6decab7788eca662b10e8c18351d20df212" 3119a6d]:
{{{
#!CommitTicketReference repository=""
revision="3119a6decab7788eca662b10e8c18351d20df212"
Fixed #26607 -- Allowed customizing formset kwargs with
ModelAdmin.get_formset_kwargs().
Thanks Nick Pope for reviews.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:16>