beat.web.ui.widgets module¶
-
class
beat.web.ui.widgets.CodeMirrorJavascript(js)[source]¶ Bases:
objectAn object used to mark Javascript sections in JSON output.
If an object of this type is passed to CodeMirrorJSONEncoder().encode(), the text containined in it will be output with no transformations applied. Most likely this will not be valid JSON, but it will be valid Javascript, assuming valid Javascript was passed to the constructor.
Example usage:
- my_data = {
‘someKey’: True, ‘someCallback’: CodeMirrorJavascript(“function() { return true; }”)
}
CodeMirrorJSONEncoder().encode(my_data)
# -> ‘{“someKey”: true, “someCallback”: function() { return true; }}’
-
class
beat.web.ui.widgets.CodeMirrorJSONEncoder(*args, **kwargs)[source]¶ Bases:
json.encoder.JSONEncoderA custom JSON encoder that knows how to handle CodeMirrorJavascript() objects.
-
stash_prefix= 'js_stash::'¶
-
default(obj)[source]¶ Implement this method in a subclass such that it returns a serializable object for
o, or calls the base implementation (to raise aTypeError).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
-
-
class
beat.web.ui.widgets.FingerPrintedMedia(media=None, css=None, js=None)[source]¶ Bases:
django.forms.widgets.MediaSubclass that adds version fingerprinting to the Media urls
-
class
beat.web.ui.widgets.CodeMirrorTextarea(attrs=None, mode=None, theme=None, config=None, size=None, dependencies=(), addon_js=(), addon_css=(), custom_mode=None, custom_js=(), keymap=None, **kwargs)[source]¶ Bases:
django.forms.widgets.TextareaTextarea widget render with CodeMirror
CodeMirror: http://codemirror.net/
-
property
media¶
-
property