在django 1.6中,下面的模板/表单在我点击“提交”按钮后没有提交帖子请求,但是当我运行django 1.5.3时这一切都有效! 我缺少什么?
这是我简化的摘录:
class Codici(models.Model):
PIECES = 'pcs'
GRAM = 'g'
METRE = 'm'
SI_UNITS_CHOICES = (
(PIECES, 'pezzi'),
(GRAM, 'grammi'),
(METRE, 'metri'),
)
codice = models.CharField(max_length=120, unique=True)
descrizione = models.TextField(blank=True)
stock = models.BigIntegerField(default=0)
fornitori = models.ManyToManyField(Fornitori)
si_unit = models.CharField(max_length=3,
choices=SI_UNITS_CHOICES,
default=PIECES)
def get_absolute_url(self):
return reverse('update', kwargs={'pk': self.pk})
url(r'^codici/update/(?P<pk>\d+)/$',
CodiceUpdateView.as_view(),
name='update'),
class CodiceForm(ModelForm):
class Meta:
model = Codici
fields = ('codice', 'descrizione', 'stock', 'si_unit',
'fornitori')
class CodiceUpdateView(UpdateView):
model = Codici
form_class = CodiceForm
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block content %}
<form action="" method="post">{% csrf_token %}
{{ form|crispy }}
<button type="submit" value="Update">Save</button>
</form>
{% endblock %}
答案 0 :(得分:0)
这是angularjs干扰我的表单验证......