【问题标题】:How to save the multiple fields in dictionary using django views?如何使用 django 视图将多个字段保存在字典中?
【发布时间】:2016-12-09 06:00:15
【问题描述】:

我想使用 django 视图在字典中保存多个字段。

我的代码:

promotions = Promotions.objects.filter(member = request.user)
list11 = []
dictt = {}
d = []
i = 0
for q in promotions:
    c = customer_request.objects.filter(promotion = q)
    e = c.count()
    d.append(e)
    dictt[e] = e
    list11.append(c)
    print("counttttttttttttttt", dictt)

【问题讨论】:

  • 你想在这里达到什么目的?

标签: python django dictionary


【解决方案1】:

代码: img_name = {} img_name = { 'name':'xyz', 'type': 'jpg', 'path':'/temp/' }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-24
    • 2018-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-21
    相关资源
    最近更新 更多