This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
renderTemplate(template_id, context) -> string | |
Renders a template declared in the DOM with a given context. | |
Template tags: | |
<% ... %>: code | |
<%= ... %>: added to output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default_app_config = __name__ + '.apps.MyAppConfig' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.forms import formsets, model_to_dict | |
from django.http.request import QueryDict | |
def formset_data_factory(formset_class, dicts, extra_fields=None): | |
data = QueryDict(mutable=True) | |
form = formset_class.form | |
prefix = (form.prefix or formset_class.get_default_prefix()) + '-' | |
fields = form.declared_fields.viewkeys() | form.base_fields.viewkeys() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://regex101.com/r/nV4rB0/1 | |
^(([A-Za-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]+(\.[A-Za-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]+)*)|\"([A-Za-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~\.\(\)\,\:\;\<\>\@\[\] ]|\\\\|\\\")+\")(\.(([A-Za-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]+(\.[A-Za-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]+)*)|\"([A-Za-z0-9\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~\.\(\)\,\:\;\<\>\@\[\] ]|\\\\|\\\")+\"))*@(([A-Za-z0-9]+(\-[A-Za-z0-9]+)*)(\.([A-Za-z0-9]+(\-[A-Za-z0-9]+)*))*|\[((\d{1,3}(\.\d{1,3}){3})|IPv6(\:[a-zA-F0-9]{0,4}){1,7})\])$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Add {% code %}{% endcode %} tags to template. | |
Note: it will only run if it is in a block that is rendered. | |
""" | |
from __future__ import absolute_import, division, print_function, unicode_literals | |
import re | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Enum(object): | |
def __init__(self, **kwargs): | |
self.__dict__.update(kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import, division, print_function, unicode_literals | |
import six | |
from django.contrib.gis.geos import Point | |
from haystack import indexes | |
from haystack.exceptions import SpatialError | |
from haystack.utils.geo import ensure_geometry, ensure_point | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Install via: | |
from __future__ import absolute_import, division, print_function, unicode_literals | |
from wagtail.wagtailcore import hooks | |
from wagtail.wagtailimages.models import Filter | |
from .crop import CropOperation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Registers render_streamfield tag to add current page context to all block templates. | |
Usage: {% render_streamfield a_streamfield %} | |
Author: github.com/mgd020 | |
''' | |
from django import template | |
from wagtail.wagtailcore.blocks.base import Block |
OlderNewer