diff options
Diffstat (limited to 'app/gtd/models.py')
-rw-r--r-- | app/gtd/models.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/gtd/models.py b/app/gtd/models.py index 3feda46..3ad2931 100644 --- a/app/gtd/models.py +++ b/app/gtd/models.py @@ -90,12 +90,21 @@ class GTDProject(models.Model): self.body_html = markdown_to_html(md) super(GTDProject, self).save(*args, **kwargs) + class NoteType(models.IntegerChoices): ACTION = 0, ('Action') REMINDER = 1, ('Reminder') REFERENCE = 2, ('Reference') SOMEDAY = 3, ('Someday') - + + @classmethod + def string_to_int(cls, the_string): + """Convert the string value to an int value, or return None.""" + for num, string in cls.choices: + print(num, string) + if string == the_string: + return num + return None class GTDNote(models.Model): title = models.CharField(max_length=200) |