def test_object_should_do_something(): u"Registry should be represented as choices for ChoiceFields" assert that("this").equals("this") class Builder1(Registry): name = "Git Builder" scheme = "builder1://" class Builder2(Registry): name = "Mercurial Builder" scheme = "builder2://" assert that(Registry.as_choices()).equals((("Git Builder", "builder1://"), ("Mercurial Builder", "builder2://")))
def test_object_should_do_something(): u"Registry should be represented as choices for ChoiceFields" assert that("this").equals("this") class Builder1(Registry): name = 'Git Builder' scheme = 'builder1://' class Builder2(Registry): name = 'Mercurial Builder' scheme = 'builder2://' assert that(Registry.as_choices()).equals(( ('Git Builder', 'builder1://'), ('Mercurial Builder', 'builder2://'), ))
class Project(models.Model): name = models.CharField(max_length=100) backend = models.CharField(max_length=100, choices=Registry.as_choices()) created_at = models.DateTimeField(auto_now_add=True) last_changed = models.DateTimeField(null=True, blank=True) build_command = models.TextField()