Django dropdown data display issues in the control

13 views
Skip to first unread message

Ajeet Kumar Gupt

unread,
Apr 28, 2020, 1:36:34 PM4/28/20
to django...@googlegroups.com
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 .

image.png

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
image.png









--






Thanks & Regards
Ajeet Kumar Gupt
+91-9311232332

Ajeet Kumar Gupt

unread,
May 1, 2020, 2:10:58 PM5/1/20
to django...@googlegroups.com, singh...@gmail.com
Hi,
Reply all
Reply to author
Forward
0 new messages