Customize/remove select box blank option in Django
Code
category_options = (
('th','Technology'),
('sc','Science'),
('f','Food'),
('t','Travel'),
('h','Health'),
('fa','Fashion'),
)
class Blog(models.Model):
title = models.CharField(max_length=150)
description = models.TextField()
category = models.CharField(choices=category_options,max_length=2)
It creates an option at the top of the list that has no value and displays as a series of dashes:
<option value="">---------</option>
What is the cleanest way to remove this auto-generated option from the select box? I am expecting like this
<option value="">Select category</option>
Guys can you help me to update the empty dashes in django
Try to put this option in your select tag
<option value="default" selected>Select category</option>