Skip to content
Snippets Groups Projects
Verified Commit 0c307205 authored by Hangzhi Yu's avatar Hangzhi Yu Committed by Jonathan Weth
Browse files

Get next properties not by non-unique category name but by unique id

(cherry picked from commit e1b7a857)
parent aa6a18ce
No related branches found
No related tags found
1 merge request!92Prepare release 2.0rc3
...@@ -98,11 +98,11 @@ ...@@ -98,11 +98,11 @@
$(id).disabled = true; $(id).disabled = true;
} }
$.fn.setNextProperties = function (field_id, next_field_id, next_field_name) { $.fn.setNextProperties = function (field_id, next_field_id, next_field_name) {
var category = $('#' + field_id).find(':selected').text(); var id = $('#' + field_id).find(':selected').val();
$.ajax({ $.ajax({
url: '{% url "issues_get_next_properties" %}', url: '{% url "issues_get_next_properties" %}',
data: { data: {
'category': category 'id': id
}, },
dataType: 'json', dataType: 'json',
success: function (data) { success: function (data) {
......
...@@ -4,7 +4,7 @@ from django.contrib import messages ...@@ -4,7 +4,7 @@ from django.contrib import messages
from django.contrib.auth.mixins import PermissionRequiredMixin as GlobalPermissionRequiredMixin from django.contrib.auth.mixins import PermissionRequiredMixin as GlobalPermissionRequiredMixin
from django.forms.forms import BaseForm from django.forms.forms import BaseForm
from django.http import HttpResponse, JsonResponse from django.http import HttpResponse, JsonResponse
from django.shortcuts import redirect, render from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.decorators.cache import never_cache from django.views.decorators.cache import never_cache
...@@ -185,12 +185,13 @@ def add_arrows(array: list): ...@@ -185,12 +185,13 @@ def add_arrows(array: list):
@never_cache @never_cache
def issues_get_next_properties(request): def issues_get_next_properties(request):
category = request.GET.get("category", None) _id = request.GET.get("id", None)
issue_category = get_object_or_404(IssueCategory, id=_id)
next_properties = { next_properties = {
"icon": IssueCategory.objects.get(name=category).icon, "icon": issue_category.icon,
"free_text": IssueCategory.objects.get(name=category).free_text, "free_text": issue_category.free_text,
"placeholder": IssueCategory.objects.get(name=category).placeholder, "placeholder": issue_category.placeholder,
"has_children": IssueCategory.objects.get(name=category).children.exists(), "has_children": issue_category.children.exists(),
} }
return JsonResponse(next_properties) return JsonResponse(next_properties)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment