Django-floppyforms - 验证和发送不起作用

时间:2018-01-23 08:55:44

标签: python django forms django-forms django-floppyforms

我有django-floppyforms的问题。在页面上,表单显示应该 - 它是一个专用的前端。但是,表单的验证和发送不起作用。我不知道为什么。

我的表格与django-floppyforms:

from events import models
import floppyforms.__future__ as forms


class ParticipantForm(forms.ModelForm):

    class Meta:
        model = models.Participant
        fields = ('event', 'first_name', 'last_name', 'company', 'street', 'post_code', 'city', 'email', 'phone_number',)
        widgets = {'event': forms.HiddenInput}

这是我在注册模板上的表格:

<form id="anmelde-form" class="form-default" action="" method="post">{% csrf_token %}
    {% form form using "floppyforms/event_detail.html" %}
    <input type="submit" value="{% blocktrans %}Anmelden{% endblocktrans %}" class="btn btn-default bg-mid-gray" />
</form>

这是注册表模板floppyforms / event_detail.html中包含的模板:

{% load floppyforms %}{% block formconfig %}{% formconfig row using "floppyforms/rows/p.html" %}{% endblock %}


    {% form form using %}
        <div class="form-input">
            <label for="prename">First name*</label>
            {% formfield form.first_name %}
        </div>
        <div class="form-input">
            <label for="surname">Last name*</label>
            {% formfield form.last_name %}
        </div>
        <div class="form-input">
            <label for="company">Company</label>
            {% formfield form.company %}
        </div>
        <div class="form-input">
            <label for="street">Street</label>
            {% formfield form.street %}
        </div>
        <div class="form-input-wrapper">
            <div class="form-input small-4 columns">
                <label for="area-code">Post code</label>
                {% formfield form.post_code %}
            </div>
            <div class="form-input small-8 columns">
                <label for="city">City</label>
                {% formfield form.city %}
            </div>
        </div>
        <div class="form-input">
            <label for="mail">E-Mail*</label>
            {% formfield form.email %}
        </div>
        <div class="form-input">
            <label for="phone">Telefon*</label>
            {% formfield form.phone_number %}
        </div>
    {% endform %}

0 个答案:

没有答案