Thursday, September 8, 2022

Django-Admin : OveOrride add-URL of the Foreign Key Auto-Complete "add" button / + green cross

Hello Community, 

Goal : adding a parameter to the add_url embedded by the green cross of a foreignkey field in the django-admin details view.


Screenshot 2022-09-08 at 12.00.39.png

Solution : pass my parameter as a widget attrs through the formfield_for_dbfield method and override the admin template : see code paste_bin

Issue
- Template gets overriden
- I can't access attrs.my_parameter or attr.my_parameter. It remains empty. 

Am I doing something wrong? Is it a bug ? 


Best, 

Louis

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/889e1ca0-7355-44b8-9ced-cf80897f0476n%40googlegroups.com.

No comments:

Post a Comment