Django передает некоторые данные на почту
if not request.user.is_doctor and not request.user.is_staff:
bookAppointment = BookAppointmentForm()
bookAppointment.fields['doctors'].queryset = Profile.objects.filter(Q(is_active=True)&Q(is_doctor=True))
context['bookAppointment'] = bookAppointment
Я хотел бы добавить данные на страницу, если был выбран выпадающий список, без перенаправления, поскольку я пытаюсь передать таблицу обратно, и если я перенаправляю обратно, мне нужно использовать home:key, а затем выяснить, как использовать этот ключ для отображения вкладок.
d = get_date(request.GET.get('day', None))
print(d)
# Instantiate our calendar class with today's year and date
cal = Calendar(d.year, d.month)
html_cal = cal.formatmonth(withyear=True)
# Figure how to pass this
context['calendar'] = mark_safe(html_cal)
html:
<form method = "POST" action='/displayCalendar' enctype="multipart/form-data">
{% csrf_token %}
{{ bookAppointment.as_p }}
<button type="submit" name='bookAppointment'>Check availability</button>
</form>
{{calendar}}
forms.py
class BookAppointmentForm(forms.ModelForm):
class Meta:
model = Calendar
fields = ('doctors',)