1👍
✅
For the ‘User Experience’, i think you will need to write a javascript to change all distance according the clustering_method_param selected.
But, if you just want to ‘block’ this on django.
You can write a form validation, like this:
def clean(self):
cleaned_data = self.cleaned_data
clustering_method_param = cleaned_data.get('clustering_method_param', None)
distance_method_param = cleaned_data.get('distance_method_param', None)
if clustering_method_param == 'ward':
if distance_method_param != 'euclidean':
self.errors.update(
{
'distance_method_param': [u'It should be euclidean.']
}
)
return cleaned_data
1👍
Using JavaScript and Ajax is a proven fix for your problem. You can listen to the user selection on first drop-down and then display the second drop-down accordingly based on the response via ajax.
👤Rk..
- [Answered ]-Django: how to make a link on main page to sub-pages
- [Answered ]-Issues serving static files with nginx (Django)
- [Answered ]-Django template for loop inside <select> renders values after the select
- [Answered ]-Why do I get this valueerror when I try to validate my from via recaptcha?
Source:stackexchange.com