[Django] #26607: Add InlineModelAdmin.get_formset_initial_data().

38 views
Skip to first unread message

Django

unread,
May 12, 2016, 7:50:41 AM5/12/16
to django-...@googlegroups.com
#26607: Add InlineModelAdmin.get_formset_initial_data().
-------------------------------+------------------------------------------
Reporter: dsanders11 | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Keywords: admin inline formset initial
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------------
New feature that adds a method on InlineModelAdmin for providing initial
data for the inline formset. By default there is no implementation,
although one could be implemented to use `GET` parameters like
`get_changeform_initial_data`, but it wouldn't be trivial due to the list
nature of formset initial data.

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

Django

unread,
May 12, 2016, 11:36:45 AM5/12/16
to django-...@googlegroups.com
#26607: Add InlineModelAdmin.get_formset_initial_data().
-------------------------------------+-------------------------------------

Reporter: dsanders11 | Owner: nobody
Type: New feature | Status: new
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: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:1>

Django

unread,
Jun 2, 2016, 6:48:38 PM6/2/16
to django-...@googlegroups.com
#26607: Add InlineModelAdmin.get_formset_initial_data().
-------------------------------------+-------------------------------------

Reporter: dsanders11 | Owner: nobody
Type: New feature | Status: new
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
-------------------------------------+-------------------------------------
Changes (by phildini):

* needs_better_patch: 0 => 1


Comment:

Currently the PR has merge conflicts

--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:2>

Django

unread,
Sep 22, 2016, 12:57:52 PM9/22/16
to django-...@googlegroups.com
#26607: Add a hook to customize the admin's formsets parameters
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: nobody

Type: New feature | Status: new
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 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>

Django

unread,
Nov 9, 2020, 3:25:42 PM11/9/20
to django-...@googlegroups.com
#26607: Add a hook to customize the admin's formsets parameters
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: (none)
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
-------------------------------------+-------------------------------------
Changes (by Manav Agarwal):

* owner: nobody => (none)
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:4>

Django

unread,
Nov 13, 2020, 6:19:58 PM11/13/20
to django-...@googlegroups.com
#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
-------------------------------------+-------------------------------------
Changes (by Manav Agarwal):

* owner: (none) => Manav Agarwal


--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:5>

Django

unread,
Nov 15, 2020, 2:47:47 AM11/15/20
to django-...@googlegroups.com
#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

unread,
Nov 26, 2020, 4:31:36 PM11/26/20
to django-...@googlegroups.com
#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: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Manav Agarwal):

* 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>

Django

unread,
Dec 9, 2020, 5:09:41 PM12/9/20
to django-...@googlegroups.com
#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: 1
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Smith):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:8>

Django

unread,
Dec 18, 2020, 4:57:08 PM12/18/20
to django-...@googlegroups.com
#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
-------------------------------------+-------------------------------------
Changes (by Manav Agarwal):

* needs_docs: 1 => 0
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:9>

Django

unread,
Feb 2, 2021, 10:43:48 AM2/2/21
to django-...@googlegroups.com
#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: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Manav Agarwal):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:10>

Django

unread,
Feb 8, 2021, 1:01:41 AM2/8/21
to django-...@googlegroups.com
#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: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_docs: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:11>

Django

unread,
Feb 11, 2021, 4:52:17 PM2/11/21
to django-...@googlegroups.com
#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: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Manav Agarwal):

* needs_docs: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:12>

Django

unread,
Feb 12, 2021, 2:27:48 AM2/12/21
to django-...@googlegroups.com
#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
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


Comment:

Per Nick's comments.

--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:13>

Django

unread,
Feb 12, 2021, 9:09:39 AM2/12/21
to django-...@googlegroups.com
#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: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Manav Agarwal):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:14>

Django

unread,
Feb 15, 2021, 3:06:30 AM2/15/21
to django-...@googlegroups.com
#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: Ready for
formset initial | checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26607#comment:15>

Django

unread,
Feb 16, 2021, 4:25:28 AM2/16/21
to django-...@googlegroups.com
#26607: Add a hook to customize the admin's formsets parameters
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: Manav
| Agarwal
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

Keywords: admin inline | Triage Stage: Ready for
formset initial | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* 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>

Reply all
Reply to author
Forward
0 new messages