'Django smart-selects how to add cutom attributes to select options?
I am newbie to Django and I am working on a project where I have two dropdown lists one includes a list of countries and another for the cities. when the user selects a country from the country dropdown list, the city dropdownlist is updated to show the cities of the selected countries using django smart-selects I need to customize theattributes of the chained select html of cities so that each option in the cities dropdown list will include the information of the relative lat & long of the selected city, So I can have something like this:
<select name="city" class="form-control" required="" id="id_city">
<option value="248" data-lat="29.664037" data-long="32.352000"> City 1</option>
</select>
Any help how to implement this? Thanks in advance
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
