Esempio n. 1
0
def populate_todo_states(reset=False):
    """
    Create objects for the system default todo-states.
    If the argument reset=True then all current TodoState objects
    will be deleted.
    """
    if reset:
        TodoState.objects.all().delete()
    system_states = [{'abbr': 'NEXT',
                      'display': 'Next Action',
                      'actionable': True,
                      'closed': False,
                      'owner': None,
                      '_color_rgb': 0,
                      '_color_alpha': 0},
                     {'abbr': 'ACTN',
                      'display': 'Future Action',
                      'actionable': False,
                      'closed': False,
                      'owner': None,
                      '_color_rgb': 0,
                      '_color_alpha': 0},
                     {'abbr': 'DONE',
                      'display': 'Completed',
                      'actionable': False,
                      'closed': True,
                      'owner': None,
                      '_color_rgb': 0,
                      '_color_alpha': 0},
                     {'abbr': 'SMDY',
                      'display': 'Someday Maybe',
                      'actionable': False,
                      'closed': False,
                      'owner': None,
                      '_color_rgb': 0,
                      '_color_alpha': 0},
                     {'abbr': 'DFRD',
                      'display': 'Deferred',
                      'actionable': False,
                      'closed': False,
                      'owner': None,
                      '_color_rgb': 0,
                      '_color_alpha': 0},
                     {'abbr': 'WAIT',
                      'display': 'Waiting For',
                      'actionable': False,
                      'closed': True,
                      'owner': None,
                      '_color_rgb': 0,
                      '_color_alpha': 0},
                     {'abbr': 'CNCL',
                      'display': 'Cancelled',
                      'actionable': False,
                      'closed': True,
                      'owner': None,
                      '_color_rgb': 0,
                      '_color_alpha': 0},
                     {'abbr': 'HARD',
                      'display': 'Hard Scheduled',
                      'actionable': False,
                      'closed': False,
                      'owner': None,
                      '_color_rgb': 0,
                      '_color_alpha': 0}]
    for state in system_states:
        todo_state = TodoState(abbreviation = state['abbr'],
                               display_text = state['display'],
                               actionable = state['actionable'],
                               closed = state['closed'],
                               _color_rgb = state['_color_rgb'],
                               _color_alpha = state['_color_alpha'])
        todo_state.save()