src/hdalab/views/pages.py
changeset 607 17f3582ecdb1
parent 594 922fc1545933
child 636 cc2f7294f1d2
--- a/src/hdalab/views/pages.py	Tue Mar 31 02:19:43 2015 +0200
+++ b/src/hdalab/views/pages.py	Thu Apr 02 01:28:50 2015 +0200
@@ -1,9 +1,14 @@
 # -*- coding: utf-8 -*-
 
+import re
+
 from django.shortcuts import render_to_response
 from django.template import RequestContext
+from django.views.generic.base import TemplateView
+import user_agents
+
 from hdabo.models import Datasheet, TaggedSheet
-import re
+
 
 def datasheet(request, hda_id=None):
     MAX_TAG = 15
@@ -56,3 +61,25 @@
         },
         context_instance=RequestContext(request)
     )
+
+OLDER_WINDOWS = [
+    u'Windows', u'Windows Mobile', u'Windows XP',
+    u'Windows ME', u'Windows 2000', u'Windows NT 4.0',
+    u'Windows CE', u'Windows 95', u'Windows 98',
+    u'Windows 3.1', u'Windows NT'
+]
+
+class HdalabAboutPage(TemplateView):
+    
+    template_name = "a_propos.html"
+    
+    def get_context_data(self, **kwargs):
+        context = super(HdalabAboutPage, self).get_context_data(**kwargs)
+        ua_str = self.request.META.get('HTTP_USER_AGENT', '')
+        ua = user_agents.parse(ua_str)
+        if ua.os.family in OLDER_WINDOWS:
+            context['add_kanji_font'] = True
+        else:
+            context['add_kanji_font'] = False
+
+        return context