Skip to content

Dynamically modify country select form field #359

Description

@Slawikus

Hi there!

Is there any way to dynamically modify country select choices. My use case - if user have already selected a country I don't want to show this country anymore in the select options. The only way to customise country list I see in the documentation is:

class G8Countries(Countries):
    only = ['CA', 'FR', 'DE', 'IT', 'JP', 'RU', 'GB']

class VisitedCountryForm(ModelForm):
    country = CountryField(countries=G8Countries).formfield()

but there is no way to make it dynamic.

Any suggestion on how to proceed with this?

Activity

  1. Repository owner locked and limited conversation to collaborators on Mar 2, 2022
  2. converted this issue into a discussion #374 on Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions