我有一个错误,我似乎无法让我的代码的这部分工作。它给了我以下错误“element_id”是此函数的无效关键字参数。
起初,我看到我没有调用正确的模型,我已经改变了它,但它似乎仍然不起作用。
def Input(request, element_id, session_id):
input_element = get_object_or_404(InputData, pk=element_id)
voice_service = input_element.service
session = lookup_or_create_session(voice_service, session_id)
if request.method == "POST":
session = get_object_or_404(CallSession, pk=session_id)
value = 'DTMF input'
result = UserInput()
result.session = session
result.category = input_element.input_category
result.save()
return redirect(request.POST['redirect'])
session.input_step(input_element)
context = input_generate_context(input_element, session)
context['url'] = request.get_full_path(False)
return render(request, 'input.xml', context, content_type='text/xml')
输入数据模型:
class InputData(VoiceServiceElement):
"""
An element that saves user input to a line in the database.
"""
_urls_name = 'service-development:InputData'
ask_input_label = models.BooleanField(_('Ask the user to fill something in'), default=True)
input_voice_label = models.ForeignKey(
VoiceLabel,
verbose_name = _('Ask input label'),
help_text = _('The voice label that is played before the system asks the user to fill in the input'),
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name='ask_input_label_input'
)
ask_confirmation = models.BooleanField(
_('Ask the caller to confirm their input'), default=True)
ask_confirmation_voice_label = models.ForeignKey(
VoiceLabel,
verbose_name = _('Ask for confirmation voice label'),
help_text = _('The voice label that asks the user to confirm their pinput. Example: "Are you satisfied with your recording? Press 1 to confirm, or press 2 to retry."'),
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name='confirmation_voice_label_input',
)
有人可以帮我吗?
慕莱坞森
相关分类