Created
October 16, 2013 15:14
-
-
Save nikolaygit/7009319 to your computer and use it in GitHub Desktop.
Django Model Choices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.db import models | |
from django.utils.translation import ugettext_lazy as _ | |
class YourModel(models.Model): | |
CATEGORY_CHOICES = ( | |
('id1', _('Your Text 1')), | |
('id2', _('Your Text 2')), | |
('id3', _('Your Text 3')), | |
) | |
category_choice = models.CharField(_('Category Choice'), max_length=100, | |
choices=CATEGORY_CHOICES, default=CATEGORY_CHOICES[0][0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment