Here are the examples of the python api django.template.loader.render_to_string taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
676 Examples
3
Source : search.py
with GNU Affero General Public License v3.0
from 17thshard
with GNU Affero General Public License v3.0
from 17thshard
def to_tr(self) -> str:
return render_to_string(
'palanaeum/search/filters/text_filter.html',
{'field_name': self.GET_PARAM_NAME, 'value': self.search_phrase, 'label_text': self.LABEL}
)
class DateSearchFilter(SearchFilter):
3
Source : search.py
with GNU Affero General Public License v3.0
from 17thshard
with GNU Affero General Public License v3.0
from 17thshard
def to_tr(self) -> str:
return render_to_string(
'palanaeum/search/filters/date_range_filter.html',
{
'from_value': self.date_from.strftime('%Y-%m-%d'),
'to_value': self.date_to.strftime('%Y-%m-%d'),
'min_value': self.min.strftime('%Y-%m-%d'),
'max_value': self.max.strftime('%Y-%m-%d'),
'from_field_name': self.GET_DATE_FROM,
'to_field_name': self.GET_DATE_TO,
}
)
class SpeakerSearchFilter(TextSearchFilter):
3
Source : search.py
with GNU Affero General Public License v3.0
from 17thshard
with GNU Affero General Public License v3.0
from 17thshard
def to_tr(self) -> str:
return render_to_string(
'palanaeum/search/filters/tag_filter.html',
{
'field_name': self.GET_TAG_SEARCH,
'selected_tags': self.tags,
'label_text': self.LABEL
}
)
class AntiTagSearchFilter(TagSearchFilter):
3
Source : actions.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_results_bottom(self, context, nodes):
if self.actions and self.admin_view.result_count:
nodes.append(loader.render_to_string('xadmin/blocks/model_list.results_bottom.actions.html',
context=get_context_dict(context)))
site.register_plugin(ActionPlugin, ListAdminView)
3
Source : bookmark.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_nav_menu(self, context, nodes):
if self.show_bookmarks:
nodes.insert(0, loader.render_to_string('xadmin/blocks/model_list.nav_menu.bookmarks.html',
context=get_context_dict(context)))
class BookmarkView(ModelAdminView):
3
Source : chart.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_results_top(self, context, nodes):
context.update({
'charts': [{"name": name, "title": v['title'], 'url': self.get_chart_url(name, v)} for name, v in self.data_charts.items()],
})
nodes.append(loader.render_to_string('xadmin/blocks/model_list.results_top.charts.html',
context=get_context_dict(context)))
class ChartsView(ListAdminView):
3
Source : export.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_top_toolbar(self, context, nodes):
if self.list_export:
context.update({
'show_export_all': self.admin_view.paginator.count > self.admin_view.list_per_page and not ALL_VAR in self.admin_view.request.GET,
'form_params': self.admin_view.get_form_params({'_do_': 'export'}, ('export_type',)),
'export_types': [{'type': et, 'name': self.export_names[et]} for et in self.list_export],
})
nodes.append(loader.render_to_string('xadmin/blocks/model_list.top_toolbar.exports.html',
context=get_context_dict(context)))
class ExportPlugin(BaseAdminPlugin):
3
Source : filters.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_nav_menu(self, context, nodes):
if self.has_filters:
nodes.append(loader.render_to_string('xadmin/blocks/model_list.nav_menu.filters.html',
context=get_context_dict(context)))
def block_nav_form(self, context, nodes):
3
Source : filters.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_nav_form(self, context, nodes):
if self.search_fields:
context = get_context_dict(context or {}) # no error!
context.update({
'search_var': SEARCH_VAR,
'remove_search_url': self.admin_view.get_query_string(remove=[SEARCH_VAR]),
'search_form_params': self.admin_view.get_form_params(remove=[SEARCH_VAR])
})
nodes.append(
loader.render_to_string(
'xadmin/blocks/model_list.nav_form.search_form.html',
context=context)
)
site.register_plugin(FilterPlugin, ListAdminView)
3
Source : importexport.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_top_toolbar(self, context, nodes):
has_change_perm = self.has_model_perm(self.model, 'change')
has_add_perm = self.has_model_perm(self.model, 'add')
if has_change_perm and has_add_perm:
model_info = (self.opts.app_label, self.opts.model_name)
import_url = reverse('xadmin:%s_%s_import' % model_info, current_app=self.admin_site.name)
context = get_context_dict(context or {}) # no error!
context.update({
'import_url': import_url,
})
nodes.append(loader.render_to_string('xadmin/blocks/model_list.top_toolbar.importexport.import.html',
context=context))
class ImportBaseView(ModelAdminView):
3
Source : importexport.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_top_toolbar(self, context, nodes):
formats = self.get_export_formats()
form = ExportForm(formats)
context = get_context_dict(context or {}) # no error!
context.update({
'form': form,
'opts': self.opts,
'form_params': self.admin_view.get_form_params({'_action_': 'export'}),
})
nodes.append(loader.render_to_string('xadmin/blocks/model_list.top_toolbar.importexport.export.html',
context=context))
class ExportPlugin(ExportMixin, BaseAdminPlugin):
3
Source : inline.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def render(self, form, form_style, context, template_pack=TEMPLATE_PACK, **kwargs):
html = ''
detail = form.detail
for field in self.fields:
if not isinstance(form.fields[field].widget, forms.HiddenInput):
result = detail.get_field_result(field)
html += loader.render_to_string(
self.template, context={'field': form[field], 'result': result})
return html
class DeleteField(Field):
3
Source : inline.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def render(self, form, form_style, context, template_pack=TEMPLATE_PACK, **kwargs):
context = get_context_dict(context)
context.update(dict(
formset=self,
prefix=self.formset.prefix,
inline_style=self.inline_style,
**self.extra_attrs
))
return render_to_string(self.template, context)
class Inline(Fieldset):
3
Source : language.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_top_navmenu(self, context, nodes):
context = get_context_dict(context)
context['redirect_to'] = self.request.get_full_path()
nodes.append(loader.render_to_string('xadmin/blocks/comm.top.setlang.html', context=context))
class SetLangView(BaseAdminView):
3
Source : layout.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_top_toolbar(self, context, nodes):
if len(self._active_layouts) > 1:
context.update({
'layouts': self._active_layouts,
'current_icon': self._current_icon,
})
nodes.append(loader.render_to_string('xadmin/blocks/model_list.top_toolbar.layouts.html',
context=get_context_dict(context)))
site.register_plugin(GridLayoutPlugin, ListAdminView)
3
Source : refresh.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_top_toolbar(self, context, nodes):
if self.refresh_times:
current_refresh = self.request.GET.get(REFRESH_VAR)
context.update({
'has_refresh': bool(current_refresh),
'clean_refresh_url': self.admin_view.get_query_string(remove=(REFRESH_VAR,)),
'current_refresh': current_refresh,
'refresh_times': [{
'time': r,
'url': self.admin_view.get_query_string({REFRESH_VAR: r}),
'selected': str(r) == current_refresh,
} for r in self.refresh_times],
})
nodes.append(loader.render_to_string('xadmin/blocks/model_list.top_toolbar.refresh.html',
get_context_dict(context)))
site.register_plugin(RefreshPlugin, ListAdminView)
3
Source : sortablelist.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_top_toolbar(self, context, nodes):
save_node = render_to_string(
'xadmin/blocks/model_list.top_toolbar.saveorder.html', context_instance=context
)
nodes.append(save_node)
def get_media(self, media):
3
Source : wizard.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_before_fieldsets(self, context, nodes):
context = context.update(dict(self.storage.extra_data))
context['wizard'] = {
'steps': self.steps,
'management_form': ManagementForm(prefix=self.prefix, initial={
'current_step': self.steps.current,
}),
}
nodes.append(loader.render_to_string('xadmin/blocks/model_form.before_fieldsets.wizard.html', context))
def block_submit_line(self, context, nodes):
3
Source : wizard.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def block_submit_line(self, context, nodes):
context = context.update(dict(self.storage.extra_data))
context['wizard'] = {
'steps': self.steps
}
nodes.append(loader.render_to_string('xadmin/blocks/model_form.submit_line.wizard.html', context))
site.register_plugin(WizardFormPlugin, ModelFormAdminView)
3
Source : dashboard.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def widget(self):
context = {'widget_id': self.id, 'widget_title': self.title, 'widget_icon': self.widget_icon,
'widget_type': self.widget_type, 'form': self, 'widget': self}
context.update(csrf(self.request))
self.context(context)
return loader.render_to_string(self.template, context)
def context(self, context):
3
Source : edit.py
with GNU General Public License v3.0
from abaoMAO
with GNU General Public License v3.0
from abaoMAO
def render(self, form, form_style, context, template_pack=TEMPLATE_PACK, **kwargs):
html = ''
for field in self.fields:
result = self.detail.get_field_result(field)
field = {'auto_id': field}
html += loader.render_to_string(
self.template, {'field': field, 'result': result})
return html
class ModelFormAdminView(ModelAdminView):
3
Source : manifest.py
with MIT License
from adamghill
with MIT License
from adamghill
def render_html(self):
"""
Renders the markdown file into HTML.
"""
# Mock an HttpRequest when generating the HTML for static sites
request = StaticRequest(path=self.url_slug, META={})
(template, context) = render_markdown(self.slug, request)
rendered_html = render_to_string(template, context)
return rendered_html
@staticmethod
3
Source : views.py
with MIT License
from agamgn
with MIT License
from agamgn
def post_news(request):
"""发送动态,AJAX POST请求"""
post = request.POST['post'].strip()
if post:
posted = News.objects.create(user=request.user, content=post)
html = render_to_string('news/news_single.html', {'news': posted, 'request': request})
return HttpResponse(html)
else:
return HttpResponseBadRequest("内容不能为空!")
@login_required
3
Source : views.py
with MIT License
from agamgn
with MIT License
from agamgn
def get_thread(request):
"""返回动态的评论,AJAX GET请求"""
news_id = request.GET['news']
news = News.objects.select_related('user').get(pk=news_id) # 不是.get(pk=news_id).select_related('user')
# render_to_string()表示加载模板,填充数据,返回字符串
news_html = render_to_string("news/news_single.html", {"news": news}) # 没有评论的时候
thread_html = render_to_string("news/news_thread.html", {"thread": news.get_thread()}) # 有评论的时候
return JsonResponse({
"uuid": news_id,
"news": news_html,
"thread": thread_html,
})
@login_required
3
Source : forms.py
with GNU General Public License v3.0
from Aghoreshwar
with GNU General Public License v3.0
from Aghoreshwar
def send_mail(self, subject_template_name, email_template_name,
context, from_email, to_email, html_email_template_name=None):
"""
Send a django.core.mail.EmailMultiAlternatives to `to_email`.
"""
subject = loader.render_to_string(subject_template_name, context)
# Email subject *must not* contain newlines
subject = ''.join(subject.splitlines())
body = loader.render_to_string(email_template_name, context)
email_message = EmailMultiAlternatives(subject, body, from_email, [to_email])
if html_email_template_name is not None:
html_email = loader.render_to_string(html_email_template_name, context)
email_message.attach_alternative(html_email, 'text/html')
email_message.send()
def get_users(self, email):
3
Source : shortcuts.py
with GNU General Public License v3.0
from Aghoreshwar
with GNU General Public License v3.0
from Aghoreshwar
def render_to_response(template_name, context=None, content_type=None, status=None, using=None):
"""
Return a HttpResponse whose content is filled with the result of calling
django.template.loader.render_to_string() with the passed arguments.
"""
warnings.warn(
'render_to_response() is deprecated in favor of render(). It has the '
'same signature except that it also requires a request.',
RemovedInDjango30Warning, stacklevel=2,
)
content = loader.render_to_string(template_name, context, using=using)
return HttpResponse(content, content_type, status)
def render(request, template_name, context=None, content_type=None, status=None, using=None):
3
Source : shortcuts.py
with GNU General Public License v3.0
from Aghoreshwar
with GNU General Public License v3.0
from Aghoreshwar
def render(request, template_name, context=None, content_type=None, status=None, using=None):
"""
Return a HttpResponse whose content is filled with the result of calling
django.template.loader.render_to_string() with the passed arguments.
"""
content = loader.render_to_string(template_name, context, request, using=using)
return HttpResponse(content, content_type, status)
def redirect(to, *args, permanent=False, **kwargs):
3
Source : voegZaakdocumentToe_Lk01.py
with Mozilla Public License 2.0
from Amsterdam
with Mozilla Public License 2.0
from Amsterdam
def _generate_voegZaakdocumentToe_Lk01(signal, seq_no):
"""
Generate XML for Sigmax voegZaakdocumentToe_Lk01 (for the PDF case)
"""
encoded_pdf = _generate_pdf(signal)
return render_to_string('sigmax/voegZaakdocumentToe_Lk01.xml', context={
'signal': signal,
'sequence_number': seq_no,
'DOC_UUID': str(uuid.uuid4()),
'DATA': encoded_pdf.decode('utf-8'),
'DOC_TYPE': 'PDF',
'FILE_NAME': f'{signal.sia_id}.pdf'
})
def send_voegZaakdocumentToe_Lk01(signal, seq_no):
3
Source : reviews.py
with MIT License
from andreynovikov
with MIT License
from andreynovikov
def render(self, context):
ctype, object_pk = self.get_target_ctype_pk(context)
if object_pk:
template_search_list = [
"reviews/%s/%s/form.html" % (ctype.app_label, ctype.model),
"reviews/%s/form.html" % ctype.app_label,
"reviews/form.html"
]
context_dict = context.flatten()
context_dict['form'] = self.get_form(context)
context_dict['show_rating_text'] = SHOW_RATING_TEXT
formstr = render_to_string(template_search_list, context_dict)
return formstr
else:
return ''
class RenderReviewListNode(ReviewListNode):
3
Source : reviews.py
with MIT License
from andreynovikov
with MIT License
from andreynovikov
def render(self, context):
ctype, object_pk = self.get_target_ctype_pk(context)
if object_pk:
template_search_list = [
"reviews/%s/%s/list.html" % (ctype.app_label, ctype.model),
"reviews/%s/list.html" % ctype.app_label,
"reviews/list.html"
]
qs = self.get_queryset(context)
context_dict = context.flatten()
context_dict['review_list'] = self.get_context_value_from_queryset(context, qs)
context_dict['rating_choices'] = REVIEW_RATING_CHOICES
liststr = render_to_string(template_search_list, context_dict)
return liststr
else:
return ''
class RatingAverageNode(BaseReviewNode):
3
Source : views.py
with MIT License
from andreynovikov
with MIT License
from andreynovikov
def __init__(self, why):
super().__init__()
if settings.DEBUG:
self.content = render_to_string("reviews/400-debug.html", {"why": why})
@csrf_protect
3
Source : common_tools.py
with MIT License
from Arianxx
with MIT License
from Arianxx
def _send_mail(subject, template, recipient_list, kwargs):
context = dict(kwargs)
message = render_to_string(template, context=context)
from_email = getattr(settings, 'EMAIL_FROM')
fail_silently = False
if template.endswith('.html'):
msg = EmailMessage(subject, message, from_email=from_email, to=recipient_list)
msg.content_subtype = 'html'
msg.send()
else:
send_mail(subject, message, from_email=from_email, fail_silently=fail_silently, recipient_list=recipient_list)
def send_mail_thread(subject, template, recipient, **kwargs):
3
Source : models.py
with Apache License 2.0
from aropan
with Apache License 2.0
from aropan
def link_accounts(to, accounts, message=None, sender=None):
text = 'New accounts have been linked to you. Check your < a href="/coder/" class="alert-link">profile page < /a>.'
if message:
text += ' ' + message
text = f' < div>{text} < /div>'
for account in accounts:
context = {
'account': account,
'resource': account.resource,
'with_resource': True,
'without_country': True,
'with_account_default_url': True,
}
rendered_account = render_to_string('account_table_cell.html', context)
rendered_account = re.sub(r'\s*\n+', r'\n', rendered_account)
text += f' < div>{rendered_account} < /div>'
NotificationMessage.objects.create(to=to, text=text, sender=sender)
3
Source : boundfields.py
with MIT License
from askvortsov1
with MIT License
from askvortsov1
def as_widget(self, widget=None, attrs=None, only_initial=False):
subfield_widgets = []
for i, subfield in enumerate(self.field.fields):
sub_bf = BoundField(self.form, subfield, "{}_{}".format(self.name, i))
sub_bf.field_type = subfield.__class__.__name__
subfield_widgets.append(self._subfield_as_widget(sub_bf))
return render_to_string(
"dynamic_forms/widgets/formrender.html",
context={'subfields': subfield_widgets}
)
3
Source : signals.py
with MIT License
from betagouv
with MIT License
from betagouv
def send_mail_aidant__organisations_changed(instance: Aidant, diff: dict, **_):
context = {"aidant": instance, **diff}
text_message = loader.render_to_string(
"signals/aidant__organisations_changed.txt", context
)
html_message = loader.render_to_string(
"signals/aidant__organisations_changed.html", context
)
send_mail(
from_email=settings.AIDANTS__ORGANISATIONS_CHANGED_EMAIL_FROM,
recipient_list=[instance.email],
subject=settings.AIDANTS__ORGANISATIONS_CHANGED_EMAIL_SUBJECT,
message=text_message,
html_message=html_message,
)
@receiver(post_migrate)
3
Source : test_templates.py
with MIT License
from betagouv
with MIT License
from betagouv
def test_email_template_use_https(self):
context = {"token": {"key": "KEY"}}
rendered = render_to_string(
settings.MAGICAUTH_EMAIL_HTML_TEMPLATE, context=context
)
assert ' < td align="center"> < a href="https://' in rendered
3
Source : test_template_parser.py
with BSD 3-Clause "New" or "Revised" License
from boxed
with BSD 3-Clause "New" or "Revised" License
from boxed
def test_template_parser_bad_blocks():
with pytest.raises(Exception) as e:
loader.render_to_string('test_template_parser_bad_blocks.html')
assert str(e.value) == """Invalid blocks specified:
doesnotexist
Valid blocks:
body
content"""
@pytest.mark.skip('Broken')
3
Source : test_template_parser.py
with BSD 3-Clause "New" or "Revised" License
from boxed
with BSD 3-Clause "New" or "Revised" License
from boxed
def test_template_parser_throwing_away_html():
with pytest.raises(Exception) as e:
loader.render_to_string('test_template_parser_throws_away_html.html')
print(str(e.value))
assert str(e.value) == """The following html was thrown away when rendering test_template_parser_throws_away_html.html:
'This gets thrown away silently by django'"""
@pytest.mark.skip('Broken')
3
Source : test_template_parser.py
with BSD 3-Clause "New" or "Revised" License
from boxed
with BSD 3-Clause "New" or "Revised" License
from boxed
def test_template_parser_valid_cases():
loader.render_to_string('test_template_parser_throwing_bad_blocks_base_base.html')
loader.render_to_string('test_template_parser_no_errors.html')
@pytest.mark.skip('Broken')
3
Source : email_utils.py
with GNU General Public License v3.0
from buildlyio
with GNU General Public License v3.0
from buildlyio
def send_email(email_address: str, subject: str, context: dict, template_name: str,
html_template_name: str = None) -> int:
text_content = loader.render_to_string(template_name, context, using=None)
html_content = loader.render_to_string(html_template_name, context, using=None) if html_template_name else None
return send_email_body(email_address, subject, text_content, html_content)
def send_email_body(email_address: str, subject: str, text_content: str, html_content: str = None) -> int:
3
Source : language.py
with GNU General Public License v3.0
from cc0411
with GNU General Public License v3.0
from cc0411
def block_top_navmenu(self, context, nodes):
context = get_context_dict(context)
context['redirect_to'] = self.request.get_full_path()
nodes.append(loader.render_to_string('xadmin/blocks/comm.top.setlang.html', context=context))
class SetLangView(BaseAdminView):
3
Source : forms.py
with MIT License
from chunky2808
with MIT License
from chunky2808
def send_mail(self, subject_template_name, email_template_name,
context, from_email, to_email, html_email_template_name=None):
"""
Sends a django.core.mail.EmailMultiAlternatives to `to_email`.
"""
subject = loader.render_to_string(subject_template_name, context)
# Email subject *must not* contain newlines
subject = ''.join(subject.splitlines())
body = loader.render_to_string(email_template_name, context)
email_message = EmailMultiAlternatives(subject, body, from_email, [to_email])
if html_email_template_name is not None:
html_email = loader.render_to_string(html_email_template_name, context)
email_message.attach_alternative(html_email, 'text/html')
email_message.send()
def get_users(self, email):
3
Source : shortcuts.py
with MIT License
from chunky2808
with MIT License
from chunky2808
def render_to_response(template_name, context=None, content_type=None, status=None, using=None):
"""
Returns a HttpResponse whose content is filled with the result of calling
django.template.loader.render_to_string() with the passed arguments.
"""
content = loader.render_to_string(template_name, context, using=using)
return HttpResponse(content, content_type, status)
def render(request, template_name, context=None, content_type=None, status=None, using=None):
3
Source : shortcuts.py
with MIT License
from chunky2808
with MIT License
from chunky2808
def render(request, template_name, context=None, content_type=None, status=None, using=None):
"""
Returns a HttpResponse whose content is filled with the result of calling
django.template.loader.render_to_string() with the passed arguments.
"""
content = loader.render_to_string(template_name, context, request, using=using)
return HttpResponse(content, content_type, status)
def redirect(to, *args, **kwargs):
3
Source : hooks.py
with MIT License
from cmu-lib
with MIT License
from cmu-lib
def inject_edit_article(context):
"""
Inject a button into dashboard article management page that allows authors to submit an article update
"""
request = context.get('request')
plugin = models.Plugin.objects.get(name=plugin_settings.SHORT_NAME)
edit_article_enabled = setting_handler.get_plugin_setting(plugin, 'edit_article_enabled', request.journal)
if not edit_article_enabled.value:
return ''
return render_to_string(
'archive_plugin/inject_edit_article.html',
context={'article': context.get('article')},
request=request
)
def inject_article_archive_warning(context):
3
Source : hooks.py
with MIT License
from cmu-lib
with MIT License
from cmu-lib
def inject_journal_archive(context):
"""
Injects a link for the user to browse a list of previous archives of the encyclopedia
"""
request = context.get('request')
plugin = models.Plugin.objects.get(name=plugin_settings.SHORT_NAME)
journal_archive_enabled = setting_handler.get_plugin_setting(plugin, 'journal_archive_enabled', request.journal)
if not journal_archive_enabled.value:
return ''
return render_to_string('archive_plugin/inject_journal_archive.html', request=request)
def inject_request_edit_update(context):
3
Source : hooks.py
with MIT License
from cmu-lib
with MIT License
from cmu-lib
def inject_request_edit_update(context):
"""
Injects a button for editors to request that an article be edited
"""
request = context.get('request')
plugin = models.Plugin.objects.get(name=plugin_settings.SHORT_NAME)
edit_article_enabled = setting_handler.get_plugin_setting(plugin, 'edit_article_enabled', request.journal)
if not edit_article_enabled.value:
return ''
return render_to_string(
'archive_plugin/inject_request_edit_update.html',
context={'article': context.get('article')},
request=request
)
def reconfigure_archive_search(context):
3
Source : base_blocks.py
with BSD 3-Clause "New" or "Revised" License
from coderedcorp
with BSD 3-Clause "New" or "Revised" License
from coderedcorp
def render(self, value, context=None):
template = value['settings']['custom_template']
if not template:
template = self.get_template(context=context)
if not template:
return self.render_basic(value, context=context)
if context is None:
new_context = self.get_context(value)
else:
new_context = self.get_context(value, parent_context=dict(context))
return mark_safe(render_to_string(template, new_context))
class BaseLayoutBlock(BaseBlock):
3
Source : integration_models.py
with BSD 3-Clause "New" or "Revised" License
from coderedcorp
with BSD 3-Clause "New" or "Revised" License
from coderedcorp
def render_js(self, name, list_library, json_value):
ctx = {
'widget_name': name,
'widget_js_name': name.replace('-', '_'),
'list_library': list_library,
'stored_mailchimp_list': self.get_stored_mailchimp_list(json_value),
'stored_merge_fields': self.get_stored_merge_fields(json_value),
}
return render_to_string(self.js_template_name, ctx)
def get_json_value(self, value):
3
Source : page_models.py
with BSD 3-Clause "New" or "Revised" License
from coderedcorp
with BSD 3-Clause "New" or "Revised" License
from coderedcorp
def render_pin_description(self):
return render_to_string(
'coderedcms/includes/map_pin_description.html',
{
'page': self
}
)
@property
See More Examples