print('Hello, world!')
with open(str(API_FGIS) + 'mpi_detail_list.json', 'r') as data_mpi_detail:
data_mpi_detail = json.load(data_mpi_detail)
t = 52
print(data_mpi_detail[t]['budgetLimits'][str(data_mpi_detail[t]['year'])])
print('***********')
for i in range(len(data_mpi_detail)):
budget_f = data_mpi_detail[i]['budgetLimits'][str(data_mpi_detail[i]['year'])]
budget_s = data_mpi_detail[i]['budgetLimits'][str(data_mpi_detail[i]['year'] + 1)]
budget_t = data_mpi_detail[i]['budgetLimits'][str(data_mpi_detail[i]['year'] + 2)]
if budget_f == '':
budget_f = 0
print(budget_f)
if budget_s == '':
budget_s = 0
if budget_t == '':
budget_t = 0
try:
Mpi.objects.filter(kmi=data_mpi_detail[i]['code']).update(budget_f=budget_f)
Mpi.objects.filter(kmi=data_mpi_detail[i]['code']).update(budget_s=budget_s)
Mpi.objects.filter(kmi=data_mpi_detail[i]['code']).update(budget_t=budget_t)
except:
print('КЛЮЧА НЕТ')