Skip to content

Instantly share code, notes, and snippets.

@bencleary
Last active August 23, 2019 09:44
Show Gist options
  • Save bencleary/87c33623fa2f61e5e58b6e8f3b01b6aa to your computer and use it in GitHub Desktop.
Save bencleary/87c33623fa2f61e5e58b6e8f3b01b6aa to your computer and use it in GitHub Desktop.
from .utils import CustomerTypes
class Customer(models.Model):
...
type = models.IntegerField(choices=CustomerTypes.choices(), default=CustomerTypes.PROSPECT)
...
def get_customer_type_label(self):
return CustomerTypes(self.type).name.title()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment