dr.botzo/choices/models.py

21 lines
455 B
Python

"""Define choice set models"""
from django.db import models
class ChoiceSet(models.Model):
"""Define collections of possible choices."""
name = models.CharField(max_length=20)
choices = models.TextField()
def __str__(self):
"""String representation."""
return "{0:s} - {1:s}".format(self.name, self.choices)
def choices_list(self):
"""Return choices as a list."""
return self.choices.split(',')