weekarchiveビューを機能させようとしていますが、次のエラーが発生します:
NameError at /archive/week/2012/48/
global name '_get_next_prev_month' is not defined
Request Method: GET
Request URL: http://localhost:8000/archive/week/2012/48/
Django Version: 1.4.2
Exception Type: NameError
Exception Value:
global name '_get_next_prev_month' is not defined
Exception Location: /job/views.py in get_next_week, line 79
Python Executable: /jobenv/bin/python
Python Version: 2.7.3
これは私のビューが継承するサブクラスです:
class BetterWeekArchiveView(WeekArchiveView):
def get_next_week(self, date):
"""
Get the next valid week.
"""
from datetime import timedelta
next = date + timedelta(days=7)
return _get_next_prev_month(self, next, is_previous=False, use_first_day=False)
def get_previous_week(self, date):
"""
Get the previous valid week.
"""
from datetime import timedelta
prev = date - timedelta(days=7)
return _get_next_prev_month(self, prev, is_previous=True, use_first_day=False)
def get_dated_items(self):
"""
Return (date_list, items, extra_context) for this request.
Inject next_week and previous_week into extra_context.
"""
result = super(BetterWeekArchiveView, self).get_dated_items()
extra_context = result[2]
date = extra_context['week']
extra_context.update({
'next_week': self.get_next_week(date),
'previous_week': self.get_previous_week(date),
})
return result
これがビューです:
class week_archive(BetterWeekArchiveView):
model=Job
allow_future =True
allow_empty=True
paginate_by=12
date_field='datemade'
template_name='task/task_archive_week'
def get_queryset(self):
return Job.objects.filter(author=self.request.user)
このBetterWeekArchiveView()は、WeekArchiveViewをページ付けするにはどうすればよいですか?
私は何を間違えましたか?