|
@@ -13,6 +13,7 @@ from jet.dashboard.modules import DashboardModule
|
|
|
from oauth2client.client import flow_from_clientsecrets, OAuth2Credentials, AccessTokenRefreshError, Storage
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
from django.conf import settings
|
|
|
+from django.utils.encoding import force_text
|
|
|
|
|
|
try:
|
|
|
from django.utils.encoding import force_unicode
|
|
@@ -140,12 +141,12 @@ class CredentialWidget(Widget):
|
|
|
if value and len(value) > 0:
|
|
|
link = '<a href="%s">%s</a>' % (
|
|
|
reverse('jet-dashboard:google-analytics-revoke', kwargs={'pk': self.module.model.pk}),
|
|
|
- _('Revoke access')
|
|
|
+ force_text(_('Revoke access'))
|
|
|
)
|
|
|
else:
|
|
|
link = '<a href="%s">%s</a>' % (
|
|
|
reverse('jet-dashboard:google-analytics-grant', kwargs={'pk': self.module.model.pk}),
|
|
|
- _('Grant access')
|
|
|
+ force_text(_('Grant access'))
|
|
|
)
|
|
|
|
|
|
attrs = self.build_attrs({
|
|
@@ -175,10 +176,10 @@ class GoogleAnalyticsSettingsForm(forms.Form):
|
|
|
def set_counter_choices(self, module):
|
|
|
counters = module.counters()
|
|
|
if counters is not None:
|
|
|
- self.fields['counter'].choices = (('', '-- %s --' % _('none')),)
|
|
|
+ self.fields['counter'].choices = (('', '-- %s --' % force_text(_('none'))),)
|
|
|
self.fields['counter'].choices.extend(map(lambda x: (x['id'], x['websiteUrl']), counters))
|
|
|
else:
|
|
|
- label = _('grant access first') if module.credential is None else _('counters loading failed')
|
|
|
+ label = force_text(_('grant access first')) if module.credential is None else force_text(_('counters loading failed'))
|
|
|
self.fields['counter'].choices = (('', '-- %s -- ' % label),)
|
|
|
|
|
|
|