@require_POST
@permission_required('questions.change_question')
def edit_details(request, question_id):
    try:
        product = Product.objects.get(id=request.POST.get('product'))
        topic = Topic.objects.get(id=request.POST.get('topic'),
                                  product=product)
        locale = request.POST.get('locale')

        # If locale is not in AAQ_LANGUAGES throws a ValueError
        tuple(QuestionLocale.objects.locales_list()).index(locale)
    except (Product.DoesNotExist, Topic.DoesNotExist, __HOLE__):
        return HttpResponseBadRequest()

    question = get_object_or_404(Question, pk=question_id)
    question.product = product
    question.topic = topic
    question.locale = locale
    question.save()

    return redirect(reverse('questions.details',
                            kwargs={'question_id': question_id}))
dataset/ETHPy150Open mozilla/kitsune/kitsune/questions/views.py/edit_details