def update_task_from_issue(issue, repo): url = issue['html_url'] try: task = Task.objects.get(github_link=url) except Task.DoesNotExist: task = Task() try: task.project = Project.objects.get(github_repo_link=repo['html_url'], name=issue['milestone']['title']) except (Project.DoesNotExist, TypeError): pass try: task.assigned = TeamMember.objects.get( github_login=issue['assignee']['login']) except (TeamMember.DoesNotExist, TypeError): pass # the following attributes are the ones that are always set task.description = issue['title'] task.github_link = url task.status = issue['state'] task.save() return task
def update_task_from_issue(issue, repo): url = issue['html_url'] try: task = Task.objects.get(github_link=url) except Task.DoesNotExist: task = Task() try: task.project = Project.objects.get(github_repo_link=repo['html_url'], name=issue['milestone']['title']) except (Project.DoesNotExist, TypeError): pass try: task.assigned = TeamMember.objects.get(github_login=issue['assignee']['login']) except (TeamMember.DoesNotExist, TypeError): pass # the following attributes are the ones that are always set task.description = issue['title'] task.github_link = url task.status = issue['state'] task.save() return task