1

我对 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 %}
4

0 回答 0