def template_contexts(self): lang = _get_proper_language() contexts = { 'lang': lang, 'url': { 'upload_attachment': reverse('django_summernote-upload_attachment'), }, } if lang != 'en-US': contexts['url']['language'] = static( 'summernote/lang/summernote-' + lang + '.min.js') for option in __summernote_options__: v = self.attrs.get(option, summernote_config.get(option)) if v is not None: # Proxy models are not JSON serializable. Values obtained from the Django core via ugettext_lazy will # return a __proxy__ type that is not serializble using the default serializers. # This quick hack checks to see if the value is a proxy type and if so forces evaluation # so that it can be serialized if '.__proxy__' in str(type(v)): v = str(v) contexts[option] = v # Merge 'summernote' dict as it is. contexts.update(summernote_config.get('summernote', {})) return contexts
def template_contexts(self): contexts = { "lang": _get_proper_language(), "url": {"upload_attachment": reverse("django_summernote-upload_attachment")}, } for option in __summernote_options__: v = self.attrs.get(option, summernote_config.get(option)) if v: contexts[option] = v return contexts
def summernote_settings(self): lang = _get_proper_language() summernote_settings = summernote_config.get('summernote', {}).copy() summernote_settings.update({ 'lang': lang, 'url': { 'language': static('summernote/lang/summernote-' + lang + '.min.js'), 'upload_attachment': reverse('django_summernote-upload_attachment'), }, }) return summernote_settings
def template_contexts(self): contexts = { 'lang': _get_proper_language(), 'url': { 'upload_attachment': reverse('django_summernote-upload_attachment'), }, } for option in __summernote_options__: v = self.attrs.get(option, summernote_config.get(option)) if v: contexts[option] = v return contexts