Bases: unicode
A JS variable.
This is a simple unicode string. This class type acts as a marker that this string is a JS variable name, so it must not be quoted by convert_py_to_js_data() while rendering the JS code.
Bases: django_select2.util.JSVar
A JS function name.
From rendering point of view, rendering this is no different from JSVar. After all, a JS varible can refer a function instance, primitive constant or any other object. They are still all varibles.
Tip
Do use this marker for JS functions. This will make the code clearer, and the purpose more easier to understand.
Bases: django_select2.util.JSVar
A JS function name to run in context of some other Html DOM element.
Like :py:class:JSFunction`, this too flags the string as JS function, but with a special requirement. The JS function needs to be invoked in the context of a Html DOM, such that, this inside the function refers to that DOM instead of window.
Tip
JS functions of this type are warapped inside special another JS function – django_select2.runInContextHelper.
This wraps inner_code string inside the following code block:
<script>
$(function () {
// inner_code here
});
</script>
| Return type: | unicode |
|---|
Gets a sub-set of a dict.
| Parameters: | |
|---|---|
| Return type: |
Converts Python data type to JS data type.
Practically what this means is, convert False to false, True to true and so on. It also takes care of the conversion of JSVar, JSFunction and JSFunctionInContext. It takes care of recursively converting lists and dictionaries too.
| Parameters: |
|
|---|---|
| Return type: |
Converts a Python dictionary to JS map.
| Parameters: |
|
|---|---|
| Return type: |
Converts a Python list (or any iterable) to JS array.
| Parameters: |
|
|---|---|
| Return type: |
Converts a Python list (or any iterable) of strings to JS array.
convert_to_js_arr() can always be used instead of this. However, since it knows that it only contains strings, it cuts down on unnecessary computations.
| Return type: | unicode |
|---|
Decorator to synchronize multiple calls to a functions.
Checks if val is a valid generated Id.
| Parameters: | val (str) – The value to check. |
|---|---|
| Return type: | bool |
Registers an Auto field for use with views.AutoResponseView.
| Parameters: |
|
|---|---|
| Returns: | The generated Id for this field. If given key was already registered then the Id generated that time, would be returned. |
| Return type: |