'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'pagination.middleware.PaginationMiddleware',
+ 'django_user_agents.middleware.UserAgentMiddleware',
)
ROOT_URLCONF = 'urls'
# 'telecaster',
'extra_views',
'captcha',
+ 'django_user_agents',
)
TEMPLATE_CONTEXT_PROCESSORS = (
SUIT_CONFIG = {
'ADMIN_NAME': 'TeleForma Admin',
}
+
+# Cache backend is optional, but recommended to speed up user agent parsing
+CACHES = {
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
+ 'LOCATION': '127.0.0.1:11211',
+ }
+}
+
+# Name of cache backend to cache user agents. If it not specified default
+# cache alias will be used. Set to `None` to disable caching.
+USER_AGENTS_CACHE = 'default'
context = super(ScriptsView, self).get_context_data(**kwargs)
context['period'] = Period.objects.get(id=self.kwargs['period_id'])
context['upload'] = getattr(settings, 'TELEFORMA_EXAM_SCRIPT_UPLOAD', True)
- print self.request.user_agent.device
return context
@method_decorator(login_required)
{% block module-action %}
{% if media.item.file and media.is_published or user.is_superuser or user.is_staff %}
- {% if not "video" in media.mime_type or perms.telemeta.can_play_all_items %}
+ {% if not "video" in media.mime_type or perms.telemeta.can_play_all_items or request.user_agent.os.family == 'iOS' %}
<div class="module_action">
<a href="{{ MEDIA_URL }}{{ media.item.file }}" class="component_icon button" id="action_red"><img src="{{STATIC_URL}}teleforma/images/download_media.png" alt="" style="vertical-align:middle" /> {% trans "Download" %}</a>
</div>