django-admin-flexselect icon indicating copy to clipboard operation
django-admin-flexselect copied to clipboard

Prepopulate when there's already a default?

Open dannyadair opened this issue 13 years ago • 1 comments

Hi, thanks for flexselect! It's definitely the cleanest solution to django admin chained selects around.

If I give the triggering field an initial value then I currently have to do a Javascript call to change() manually. Would be great if the trigger fields were checked for an existing value and triggered initially if there was any.

Cheers, Danny

dannyadair avatar Oct 01 '11 03:10 dannyadair

Example: Taking the flexselect example model, this problem occurs when "company_contact_person" is not a required field. Then you can set the "Company", leave "Company contact person" blank, and next time you visit the "Case", the "Company contact person" won't be filtered by the company that is already selected.

class Case(m.Model):
    client = m.ForeignKey(Client)
    company_contact_person = m.ForeignKey(CompanyContactPerson, null=True, blank=True)

dannyadair avatar Oct 05 '11 10:10 dannyadair