-
来自
django.core.signing
此外,由于 JSON 仅支持字符串键,请注意在
request.session
中使用非字符串键将无法按预期工作:>>> # initial assignment >>> request.session[0] = 'bar' >>> # subsequent requests following serialization & deserialization >>> # of session data >>> request.session[0] # KeyError >>> request.session['0'] 'bar'
同样,无法以 JSON 编码的数据,例如像
'\xd9'
(引发UnicodeDecodeError
有关 JSON 序列化限制的更多详细信息,请参阅编写您自己的序列化程序部分。
本文介绍 django.contrib.sessions.serializers.JSONSerializer
的用法。
声明
class serializers.JSONSerializer
相关用法
- Python Django JSONCatalog用法及代码示例
- Python JSON转CSV用法及代码示例
- Python JSON转string用法及代码示例
- Python Django JSONObject用法及代码示例
- Python Django JSONBAgg.ordering用法及代码示例
- Python JSON转dictionary用法及代码示例
- Python Django JavaScriptCatalog.packages用法及代码示例
- Python cudf.core.column.string.StringMethods.is_vowel用法及代码示例
- Python torch.distributed.rpc.rpc_async用法及代码示例
- Python torch.nn.InstanceNorm3d用法及代码示例
- Python sklearn.cluster.MiniBatchKMeans用法及代码示例
- Python pandas.arrays.IntervalArray.is_empty用法及代码示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代码示例
- Python numpy.less()用法及代码示例
- Python Matplotlib.figure.Figure.add_gridspec()用法及代码示例
- Python tf.compat.v1.distribute.MirroredStrategy.experimental_distribute_dataset用法及代码示例
- Python Django File.save用法及代码示例
- Python Sympy Permutation.list()用法及代码示例
- Python dask.dataframe.Series.apply用法及代码示例
- Python networkx.algorithms.shortest_paths.weighted.all_pairs_dijkstra_path用法及代码示例
- Python scipy.ndimage.binary_opening用法及代码示例
- Python pyspark.pandas.Series.dropna用法及代码示例
- Python torchaudio.transforms.Fade用法及代码示例
- Python dask.dataframe.to_records用法及代码示例
- Python arcgis.gis._impl._profile.ProfileManager.save_as用法及代码示例
注:本文由纯净天空筛选整理自djangoproject.com大神的英文原创作品 django.contrib.sessions.serializers.JSONSerializer。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。