def new_issue(request): if request.POST: issue_form = IssueForm(request.POST) if issue_form.is_valid(): try: jira = get_jira() issue_dict = { 'project': { 'key': settings.JIRA_PROJECT_KEY }, 'summary': '[' + issue_form.cleaned_data['module_name'] + '] ' + issue_form.cleaned_data['name'], 'description': issue_form.cleaned_data['description'], 'issuetype': { 'name': issue_form.cleaned_data['type'] }, 'priority': { 'name': issue_form.cleaned_data['priority'] }, 'labels': [request.user.username] } new_issue = jira.create_issue(fields=issue_dict) return redirect(reverse('admin_helpdesk_view')) except Exception as ex: logger.error('Error during new issue creation: ' + str(ex)) issue_form = None else: issue_form = IssueForm() context = {'form': issue_form} return render_to_response('admin/helpdesk_new.html', context, context_instance=RequestContext(request))
def admin_helpdesk_issue_view(request, issue_slug): e = None a = '-' issue = None commnets = None issue_form = None try: jira = get_jira() issue = jira.issue(issue_slug) if issue.fields.status.name == 'Closed': can_reopen = True can_close = False else: can_reopen = False can_close = True commnets = jira.comments(issue) if request.POST: issue_form = IssueForm(request.POST) if issue_form.is_valid(): a = [ issue_form.cleaned_data['name'], issue_form.cleaned_data['description'], issue_form.cleaned_data['type'], issue_form.cleaned_data['priority'] ] issue.update( summary=issue_form.cleaned_data['name'], description=issue_form.cleaned_data['description'], issuetype={'name': issue_form.cleaned_data['type']}, priority={'name': issue_form.cleaned_data['priority']}) else: data = { 'name': issue.fields.summary, 'description': issue.fields.description, 'type': issue.fields.issuetype.name, 'priority': issue.fields.priority.name, } issue_form = IssueForm(data) except Exception as ex: e = ex logger.error('Error during JIRA main view generation: ' + str(ex)) context = { 'issue': issue, 'commnets': commnets, 'form': issue_form, 'e': e, 'a': a, 'file_form': SimpleFileForm(), 'can_reopen': can_reopen, 'can_close': can_close } return render_to_response('admin/helpdesk_detail.html', context, context_instance=RequestContext(request))
def admin_helpdesk_issue_view(request, issue_slug): e = None a = '-' issue = None commnets = None issue_form = None try: jira = get_jira() issue = jira.issue(issue_slug) if issue.fields.status.name == 'Closed': can_reopen = True can_close = False else: can_reopen = False can_close = True commnets = jira.comments(issue) if request.POST: issue_form = IssueForm(request.POST) if issue_form.is_valid(): a = [issue_form.cleaned_data['name'], issue_form.cleaned_data['description'], issue_form.cleaned_data['type'], issue_form.cleaned_data['priority']] issue.update(summary=issue_form.cleaned_data['name'], description=issue_form.cleaned_data['description'], issuetype={'name': issue_form.cleaned_data['type']}, priority={'name': issue_form.cleaned_data['priority']}) else: data = { 'name': issue.fields.summary, 'description': issue.fields.description, 'type': issue.fields.issuetype.name, 'priority': issue.fields.priority.name, } issue_form = IssueForm(data) except Exception as ex: e = ex logger.error('Error during JIRA main view generation: ' + str(ex)) context = {'issue': issue, 'commnets': commnets, 'form': issue_form, 'e': e, 'a': a, 'file_form': SimpleFileForm(), 'can_reopen': can_reopen, 'can_close': can_close} return render_to_response('admin/helpdesk_detail.html', context, context_instance=RequestContext(request))
def new_issue(request): if request.POST: issue_form = IssueForm(request.POST) if issue_form.is_valid(): try: jira = get_jira() issue_dict = { 'project': {'key': settings.JIRA_PROJECT_KEY}, 'summary': '[' + issue_form.cleaned_data['module_name'] + '] ' + issue_form.cleaned_data['name'], 'description': issue_form.cleaned_data['description'], 'issuetype': {'name': issue_form.cleaned_data['type']}, 'priority': {'name': issue_form.cleaned_data['priority']}, 'labels': [request.user.username] } new_issue = jira.create_issue(fields=issue_dict) return redirect(reverse('admin_helpdesk_view')) except Exception as ex: logger.error('Error during new issue creation: ' +str(ex)) issue_form = None else: issue_form = IssueForm() context = {'form': issue_form} return render_to_response('admin/helpdesk_new.html', context, context_instance=RequestContext(request))