功能未提交(django)

时间:2017-09-22 16:46:37

标签: python django

views.py

class StatisticsIndexView(StaffRestrictedMixin, TemplateView):
    model = Statistics()
    template_name = 'loanwolf/statistics/index.html'
    form = StatisticsBaseForm()

    def home(self):
       import ipdb; ipdb.set_trace()
       redirect_url = self.request.GET.get('period')
       return redirect_url

    def get_context_data(self, **kwargs):
        import ipdb; ipdb.set_trace()

        context = super(StatisticsIndexView, self).get_context_data(**kwargs)
        context.update({
            'applications_by_state': ApplicationsByState(),
            'applications_calendar': ApplicationsCalendar(),
            'new_customers_calendar': NewCustomersCalendar(),
            'statistics': Statistics(),
            'form': StatisticsBaseForm(),
        })
        return context

urls.py

urlpatterns=[

    url(r'^$', login_required(
        StatisticsIndexView.as_view()), name='index'),

]

我在home()get_context_data()方法中添加了一个断点,但是一旦我运行了提交按钮,它就只在get_context_data()中停止了。为什么它不会停留在home()方法上?如何覆盖StatisticsIndexView.as_view()以添加一些新方法?我无法理解如何使用home()方法。请注意home()是一种新方法,因此不会被覆盖。

0 个答案:

没有答案
相关问题