我想實現我的項目django-filters,但我已經打了一個路障:/不知何故filter instance
正從上下文中刪除..CBV覆蓋Django的過濾器方面
class ListReservations(LoginRequiredMixin, FilterView):
template_name = 'reservations/homepage.html'
paginate_by = 25
model = Reservation
filterset_class = ReservationFilter
def get_context_data(self, **kwargs):
ctx = super(ListReservations, self).get_context_data()
ctx['today'] = datetime.datetime.now().strftime('%d/%m')
return ctx
結果仍然得到過濾,但沒有獲得{{filter.form}}