Getting initial parameters of inline admin model formset using URL

610 views
Skip to first unread message

Manav Agarwal

unread,
Feb 11, 2021, 5:12:21 PM2/11/21
to Django developers (Contributions to Django itself)
We may pass initial Model admin form parameters using URL, visit https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_changeform_initial_data for more details.
#26607 introduces a hook to customize the initial parameters or kwargs for Django admin inline formsets. As per the discussion on the ticket and on the respective PR, It seems that adding a function to initialize formset parameters from the URL would be complex. The purpose of starting this discussion is to have some good suggestions to implement the same and also to confirm that whether we shall implement such function or not.

Carlton Gibson

unread,
Feb 12, 2021, 6:42:32 AM2/12/21
to django-d...@googlegroups.com
HI Manav. 

Thanks for your work on the PR! 

I think with the new get_formset_kwarg() method in place folks could subclass in order to add initial data.

This is in contrast to the issue the PR resolves, where there was no real access point to customise the behaviour. 

I’d say that’s the right balance in terms of utility and API surface area. 

Kind regards, 
Carlton 

On Thu, 11 Feb 2021 at 23:13, Manav Agarwal <dpsma...@gmail.com> wrote:
We may pass initial Model admin form parameters using URL, visit https://docs.djangoproject.com/en/3.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_changeform_initial_data for more details.
#26607 introduces a hook to customize the initial parameters or kwargs for Django admin inline formsets. As per the discussion on the ticket and on the respective PR, It seems that adding a function to initialize formset parameters from the URL would be complex. The purpose of starting this discussion is to have some good suggestions to implement the same and also to confirm that whether we shall implement such function or not.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1a82ee03-4dbd-493e-ad94-6a74165184aan%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages