Checklist

Requires Pro Edition and Checklists plugin >= 3.0.0.

Manager

All operations on the Checklist resource are provided by its manager. To get access to it you have to call redmine.checklist where redmine is a configured redmine object. See the Configuration about how to configure redmine object.

Create methods

create

redminelib.managers.ResourceManager.create(**fields)

Creates new Checklist resource item with given fields and saves it to the Checklists plugin.

Parameters:
  • issue_id (int) – (required). Issue to which checklist item belongs to.

  • subject (string) – (required). Subject of checklist item.

  • is_done (bool) – (optional). Whether checklist item is done.

Returns:

Resource object

>>> checklist = redmine.checklist.create(issue_id=1, subject='FooBar', is_done=False)
>>> checklist
<redminelib.resources.Checklist #1>

new

redminelib.managers.ResourceManager.new()

Creates new empty Checklist resource item but saves it to the Checklists plugin only when save() is called, also calls pre_create() and post_create() methods of the Resource object. Valid attributes are the same as for create() method above.

Returns:

Resource object

>>> checklist = redmine.checklist.new()
>>> checklist.issue_id = 1
>>> checklist.subject = 'FooBar'
>>> checklist.is_done = False
>>> checklist.save()
<redminelib.resources.Checklist #1>

Hint

Checklists can also be created/updated together with the Issue using checklists attribute:

>>> issue = redmine.issue.create(
...     project_id=123,
...     subject='foo',
...     checklists=[{'subject': 'foo', 'is_done': True}, {'subject': 'bar', 'is_done': False}]
... )
>>> issue
<redminelib.resources.Issue #3>

Read methods

get

redminelib.managers.ResourceManager.get(resource_id, **params)

Returns single Checklist resource item from the Checklists plugin by its id.

Parameters:

resource_id (int) – (required). Id of the checklist item.

Returns:

Resource object

>>> checklist = redmine.checklist.get(123)
>>> checklist
<redminelib.resources.Checklist #123>

all

Not supported by Checklists plugin

filter

redminelib.managers.ResourceManager.filter(**filters)

Returns Checklist resource items that match the given lookup parameters.

Parameters:

issue_id (int) – (required). Issue to which these checklist items belong to.

Returns:

ResourceSet object

>>> checklists = redmine.checklist.filter(issue_id=123)
>>> checklists
<redminelib.resultsets.ResourceSet object with Checklist resources>

Hint

You can also get checklist items from an Issue resource objects directly using checklists relation:

>>> issue = redmine.issue.get(1)
>>> issue.checklists
<redminelib.resultsets.ResourceSet object with Checklist resources>

Update methods

update

redminelib.managers.ResourceManager.update(resource_id, **fields)

Updates values of given fields of a Checklist resource item and saves them to the Checklists plugin.

Parameters:
  • resource_id (int) – (required). Checklist item id.

  • issue_id (int) – (optional). Checklist item issue id.

  • subject (string) – (optional). Subject of the checklist item.

  • is_done (bool) – (optional). Whether checklist item is done.

  • position (int) – (optional). Checklist item position.

Returns:

True

>>> redmine.checklist.update(1, issue_id=1, subject='FooBar', is_done=False, position=1)
True

save

redminelib.resources.Checklist.save(**attrs)

Saves the current state of a Checklist item resource to the Checklists plugin. Attrs that can be changed are the same as for update() method above.

Returns:

Resource object

>>> checklist = redmine.checklist.get(123)
>>> checklist.issue_id = 1
>>> checklist.subject = 'FooBar'
>>> checklist.is_done = False
>>> checklist.position = 1
>>> checklist.save()
<redminelib.resources.Checklist #123>

Added in version 2.1.0: Alternative syntax was introduced.

>>> checklist = redmine.checklist.get(123).save(
...     issue_id=1,
...     subject='Foobar',
...     is_done=False,
...     position=1
... )
>>> checklist
<redminelib.resources.Checklist #123>

Delete methods

delete

redminelib.managers.ResourceManager.delete(resource_id)

Deletes single Checklist resource item from the Checklists plugin by its id.

Parameters:

resource_id (int) – (required). Checklist item id.

Returns:

True

>>> redmine.checklist.delete(123)
True
redminelib.resources.Checklist.delete()

Deletes current Checklist resource item object from the Checklists plugin.

Returns:

True

>>> checklist = redmine.checklist.get(1)
>>> checklist.delete()
True

Export

Not supported by Checklists plugin