Last active
August 26, 2015 20:05
-
-
Save stephane/70fb12d7be299149d710 to your computer and use it in GitHub Desktop.
Django - Many to many with fixed list of choices
This file contains 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
class Issue(models.Model): | |
title = models.CharField(max_length=256) | |
class Label(models.Model): | |
issue = models.ForeignKey(Issue, related_name='labels') | |
NAME_CHOICES = ( | |
('bug', "Bug"), | |
('feature', "Feature"), | |
('blocker', "Release blocker"), | |
) | |
name = models.CharField(max_length=32, choices=NAME_CHOICES) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment