Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update models.py #123

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions taiga/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,21 @@ def import_(self, project, subject, priority, status, issue_type, severity, **at
return self.instance.parse(self.requester, response.json())


class EpicAttribute(CustomAttribute):
"""
EpicAttribute model
"""

endpoint = "epic-custom-attributes"


class EpicAttributes(CustomAttributes):
"""
EpicAttributes factory
"""

instance = IssueAttribute

class IssueAttribute(CustomAttribute):
"""
IssueAttribute model
Expand Down Expand Up @@ -1582,6 +1597,21 @@ def list_wikilinks(self):
"""
return WikiLinks(self.requester).list(project=self.id)

def add_epic_attribute(self, name, **attrs):
"""
Add a new Epic attribute and return a :class:`IssueAttribute` object.

:param name: name of the :class:`EpicAttribute`
:param attrs: optional attributes for :class:`EpicAttribute`
"""
return EpicAttributes(self.requester).create(self.id, name, **attrs)

def list_epic_attributes(self):
"""
Get the list of :class:`EpicAttribute` resources for the project.
"""
return EpicAttributes(self.requester).list(project=self.id)

def add_issue_attribute(self, name, **attrs):
"""
Add a new Issue attribute and return a :class:`IssueAttribute` object.
Expand Down