Reputation: 64054
I have in Django models.py this line:
class Method1(models.Model):
# other param
species_param = models.CharField(max_length=20, choices=(('mouse', 'Mouse'), ('human','Human'))
It looks like this:
Note that the default value is set to ----
.
I want to set it to Mouse
. How can I do it?
I'd like also to remove the ---
altogether.
Upvotes: 0
Views: 73
Reputation: 1453
Suggestion :
Try with initial='mouse'
Documentation : https://docs.djangoproject.com/en/dev/ref/forms/fields/#initial
Upvotes: 0
Reputation: 450
I do not test it but it may solve your problem:
class Mehod1(models.Model):
# other param
species_param = models.CharField(max_length=20, choices=(('mouse', 'Mouse'), ('human', 'Human')), default='mouse')
Upvotes: 2