How to set default STATUSES
option ?
class Order(models.Model): STATUSES = ( (u'E', u'Expected'), (u'S', u'Sent'), (u'F', u'Finished'), ) status = models.CharField(max_length=2, null=True, choices=STATUSES)
status = models.CharField(max_length=2, null=True, choices=STATUSES, default='E')
or to avoid setting an invalid default if STATUSES changes:
status = models.CharField(max_length=2, null=True, choices=STATUSES, default=STATUSES[0][0])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With