#27231: Initialize forms in ModelAdmin like View (i.e. add get_form_kwargs to
contrib.admin)
----------------------------------+--------------------------------------
Reporter: thauk-copperleaf | Owner: nobody
Type: Uncategorized | Status: new
Component: contrib.admin | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Comment (by thauk-copperleaf):
Hi Tim, sorry for not being specific enough.
My form has an autocomplete menu (django-autocomplete-light), which
visualizes a field in the model, but whose choices need to be configured
based on some properties of the model being loaded (this is the
some_parameter_for_one_thing part in my example).
I also need to set the default for this menu, if a value is chosen
already, when I show the detail page (that is the
another_parameter_for_another_thing part). To get the form/widget to get
the default correctly (via data/cleaned_data), I have to "inject" it into
the constructor call for the form.
Seeing as there's already an existing pattern in FormMixin with get_form
and get_form_kwargs, I'm thinking the implementation would follow a
similar pattern, to be consistent and as least surprising as possible, but
I haven't started working on it yet. I was hoping to first find out if
what I was proposing was a bad idea and/or could already be done.
--
Ticket URL: <https://code.djangoproject.com/ticket/27231#comment:2>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/074.c95c6bc5e8a19158b17a3e2fbfa8ef6a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.