Dear Team,
I am a beginner in Django and want to developing one assignment in django.
Now, I am created one model category and subcategory. Based on category populate the data sub-category and data have saved like the below format.
Category = Operations
Subcategory = Category1,Category2,Category3,Category4
Same like other categories.
I want to display data in index.html page selection option like
Subcategory: Category1
Category2
Category3
e.g. I looking like this .
I tried to use split function but it is not working. Please help us its a really appreciated.
My Code: How to split the values.
<select name="subcatsname">
{% for subcat in all_subcats_keys %}
<option value="{{subcat.subcategory }}">{{subcat.subcategory }}</option>
{% endfor %}
</select>
Current Scenario, data display likes