用字典整理列表,djang

2024-09-30 01:28:08 发布

您现在位置:Python中文网/ 问答频道 /正文

从django的两个模型中,我创建了一个字典列表,其中每个dictoronic是我在客户机中显示的表中的一行。你知道吗

我想能够排序为每个不同的“列”这个列表。你知道吗

objdict = []    
mydict = {
    'thing1': model1.val1,
    'thing2': model2.val1,
    'thing3': model2.val2,
    'thing4': model1.val2,
    'thing5': model1.val3,
}
objdict.append(mydict)

假设我想按升序排列这个列表。 我怎么能做到这一点?你知道吗


Tags: django模型列表客户机字典排序mydictmodel1

热门问题