Django Schedule预约表问题

时间:2019-05-02 05:13:34

标签: python django django-templates django-crispy-forms

我正在创建一个表单,用户可以在其中单击一个时隙并保留该时隙。一共有5列,一周中的每一天(星期一,星期二,星期三等)都有5列时隙(下午3点,下午4点,下午5点,下午6点,晚上7点)。

每个时隙代表一个单选框。下面的示例只有两列。

如何将单选按钮1-6和7-12分成两个不同的块。

Forms.py

class AppointmentForm(forms.Form):
One = 1
Two = 2
Three = 3
Four = 4
Five = 5
Six = 6
SEVEN = 7
EIGHT = 8
NINE = 9
TEN = 10
ELEVEN = 11
TWELVE = 12
TYPE_CHOICES = (
    (One, '3:00pm'),
    (Two, '3:45pm'),
    (Three, '4:30pm'),
    (Four, '5:15pm'),
    (Five, '6:00pm'),
    (Six, '6:45pm'),
    (SEVEN, '3:00pm'),
    (EIGHT, '3:45pm'),
    (NINE, '4:30pm'),
    (TEN, '5:15pm'),
    (ELEVEN, '6:00pm'),
    (TWELVE, '6:45pm')

)
appointment_time = forms.ChoiceField(
        choices=TYPE_CHOICES,
        label="Appointment times",
        widget=forms.RadioSelect,
        required=True,
         )

AppointmentForm.html

<form action="" method="post">
  {% csrf_token %}
  {{ form|crispy }}
  <label for="id_id_appointment_time_0_1" class="form-check-label">1:00pm</label>
  <input class="btn btn-success-alt " type="submit" value="Submit">
</form>

尝试创建此 I am trying to create the this

这是我所在的地方 This is what I have

0 个答案:

没有答案