Merge pull request #681 from Gluejar/fix-template-error

eliminate bad template errors
pull/43/head
eshellman 2017-06-12 13:51:58 -04:00 committed by GitHub
commit 8a4d404a52
1 changed files with 6 additions and 8 deletions

View File

@ -2386,11 +2386,13 @@ def kw_edit(request, work_id):
class InfoPageView(TemplateView):
template_name = 'metrics.html'
def get_template_names(self, **kwargs):
if self.kwargs['template_name']:
return (self.kwargs['template_name'])
return [self.kwargs['template_name'], self.template_name]
else:
return ('metrics.html')
return [self.template_name]
def get_context_data(self, **kwargs):
users = User.objects
@ -2471,13 +2473,9 @@ class InfoPageView(TemplateView):
'marc': marc,
}
class InfoLangView(TemplateView):
class InfoLangView(InfoPageView):
def get_template_names(self, **kwargs):
if self.kwargs['template_name']:
return (self.kwargs['template_name'])
else:
return ('languages.html')
template_name = 'languages.html'
def get_context_data(self, **kwargs):
languages = models.Work.objects.filter(num_wishes__gte = 1).values('language').annotate(lang_count=Count('language')).order_by('-lang_count')