我有一个html页面,其中包含一个下拉选择器。我将其封装在表单中,实际上,我只想在单击Update时用不同的值重新加载相同的页面。
以下是html:
<form action="{% url 'analyze:plot' %}">
<select>
{% for name in x_keys %}
<option name="x_key_name" id="{{ name }}" value="{{ name }}">{{ name }}</option>
{
错误
Started POST "/products" for 127.0.0.1 at 2017-08-05 01:23:20 -0700
Processing by ProductsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"WcfuzGz2ZaEpFmagKYTm3feGTaZxNFPlTkLu/epw7fWObs+pdO4McXw9cLUNjTguav0i97rJR1sLhL5Fk+mk0g=
我正在尝试将数据从一个成功的表单提交传递到一个谢谢页面,然后该页面可以显示这些数据。我试图做一个反向的HttpResponseRedirect,但是我不断地得到这个错误:
NoReverseMatch at /contactform/process反向表示“谢天谢地”有参数'(24,)‘没有找到。尝试了1种模式:U‘’contactform/谢谢/$‘
下面是我到目前为止掌握的代码:
views.py
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRe
这可能很容易解决。我创建了一个使用forms.ModelForm的表单。我的模型有ForeignKey字段。表单为foreignKey创建了一个select字段,但没有正确显示值。
models.py
from django.db import models
# Create your models here.
class Gender(models.Model):
name = models.CharField(max_length=8, null=True)
class Meta:
db_table='gender'
class UserExamp