template = list()
for k in result.keys():
template.append('{};{};{}\n'.format(k, result[k][0], result[k][1]))
template = list()
sort_list = list(result.keys())
sort_list.sort()
for k in sort_list:
template.append('{};{};{}\n'.format(k, result[k][0], result[k][1]))
template = ''.join(template)
print(template)
from collections import defaultdict
a = defaultdict(list)
id = [1, 2, 3, 1, 1]
val = [1, 3, 4, 5, 5]
time = [5, 6, 7, 6, 5]
for i in range(len(id)):
a[id[i]].append((val[i], time[i]))
for k in a.keys():
print(k, a[k])
def __init__(self, pk, request *args, **kwargs):
#import pdb;pdb.set_trace()
self.pk = pk
self.request = request
super(EditBranchForm, self).__init__(*args, **kwargs)
self.fields['owner'].queryset = Profiles.objects.filter(pid=self.request.user.id)
self.fields['regions'].choices = self.request.user.organization.organizationtoregion_set.all().values_list('region__id', 'region__region_name')