Always use the magic List

2018-09-02  本文已影响0人  彩虹金刚_Q

Yes i need to record this historical moment that I have solved the data transfer method problem with Python~

def home(request):

line ='[{"dut_id":"100","nickname":"Frontier","sku_id":"600WW"},{"dut_id":"101","nickname":"FRT_Gateway","sku_id":"600WW"},{"dut_id":"102","nickname":"ANT","sku_id":"600WW"},{"dut_id":"200","nickname":"Equator","sku_id":"600WW"},{"dut_id":"300","nickname":"Core2","sku_id":"600WW"},{"dut_id":"400","nickname":"Danube","sku_id":"600WW"},{"dut_id":"500","nickname":"PDA","sku_id":"600CN"}]'

    obj = json.loads(line)

nickname =list()

i =0

    while i

nickname.append(obj[i]['nickname'])

i = i+1

    return render(request, 'home.html', {'nickname': nickname})

After several investigation I found "select"/"option" is still a better choice than menu

And sadly found it is hard to change option appearance

And I still need to do some local storage as there are some matching relationships of those data

So tomorrow's task is to understand "Get" "Post" method and how to get ride of the "unique" value issue and avoid rewrite each object each time opening Home

上一篇 下一篇

猜你喜欢

热点阅读