def get(self,request,*args,**kwargs):
# These are passed via the URL
year = self.kwargs.get('year')
month = self.kwargs.get('month')
slug = self.kwargs.get('slug','')
try:
month_number = list(month_name).index(month or 0)
except ValueError:
raise Http404(_('Invalid month.'))
seriesset = get_list_or_404(Series,~Q(status=Event.RegStatus.hidden),~Q(status=Event.RegStatus.linkOnly),year=year or None,month=month_number or None,classDescription__slug=slug)
# This will pass through to the context data by default
kwargs.update({'seriesset': seriesset})
# For each Series in the set, add a button to the toolbar to edit the Series details
if hasattr(request,'user') and request.user.has_perm('core.change_series'):
for this_series in seriesset:
this_title = _('Edit Class Details')
if len(seriesset) > 1:
this_title += ' (#%s)' % this_series.id
request.toolbar.add_button(this_title, reverse('admin:core_series_change', args=([this_series.id,])), side=RIGHT)
return super(IndividualClassView,self).get(request,*args,**kwargs)
评论列表
文章目录