def create_ticker(request): market = Ticker() market.name = request.POST.get('name') market.ticker = request.POST.get('ticker') market.depth = request.POST.get('depth') market.trade = request.POST.get('trade') market.save() #return HttpResponse("OK") return redirect('/index')
def init_ticker_table(): with open('markets.json') as data_file: data = json.load(data_file) print data for d in data: market = Ticker() market.name = d['market'] market.ticker = d['ticker'] market.depth = d['depth'] market.trade = d['trade'] market.save()