def country_list(request): import string from Ujima.lobby.models import Country,Activity from django.utils import simplejson from django.db import connection r=Country.objects.all().order_by('slug') country_dict=sorted_countries(r) result={} th=[] for country in r: #c = Country.objects.get(slug=country.slug) cursor=connection.cursor() cursor.execute("select year,sum(financial_amount) from activity where country='%s' and financial_amount>0 group by year order by year;"%(country.country_cd)) res=list([[eval(x[0]),int(x[1])] for x in cursor.fetchall()]) if(country.country=="Central African Republic"): xcountry="the_Central_African_Republic" elif(country.slug=="comoro-islands"): xcountry="the_Comoros" elif(country.slug=="congo-brazzaville"): xcountry="the_Republic_of_the_Congo" elif(country.slug=="congo-kinshasa-zaire"): xcountry="the_Democratic_Republic_of_the_Congo" elif(country.slug=="cote-divoire-ivory-coast"): xcountry="Cote_d'Ivoire" elif(country.slug=="saharawi-arab-democratic-republic"): xcountry="Western_Sahara" elif(country.slug=="sao-tome-and-principe"): xcountry="Sao_Tome_and_Principe" elif(country.slug=="seychelles"): xcountry="the_Seychelles" elif(country.slug=="southwest-africa"): xcountry="Namibia" elif(country.slug=="spanish-sahara"): xcountry="Western_Sahara" elif(country.slug=="dahomey"): xcountry="Benin" elif(country.slug=="gambia"): xcountry="The_Gambia" elif(country.slug=="somali-democratic-republic"): xcountry="Somalia" else: xcountry=country.country result[str(country.slug)]={'label':country.country,'data':res} th.append((country.slug,country.country,xcountry)) sorted_result=sorted(result) t=mark_safe(simplejson.dumps(result)) tr=mark_safe(simplejson.dumps(th)) return render_to_response('country/countries.html',{'country_list':r,'res':t,'con':tr,'country_dict':country_dict})
def country_list(request): import string from django.utils import simplejson from django.db import connection r = Country.objects.all().order_by("slug") country_dict = sorted_countries(r) result = {} th = [] for country in r: # c = Country.objects.get(slug=country.slug) cursor = connection.cursor() cursor.execute("select year,sum(dollars) from aid where PCountry='%s' group by year ;" % (country.code)) res = list([[eval(x[0]), int(x[1])] for x in cursor.fetchall()]) result[str(country.slug)] = {"label": country.country, "data": res} if country.country == "Central African Republic": xcountry = "the_Central_African_Republic" elif country.slug == "comoros": xcountry = "the_Comoros" elif country.slug == "congo-brazzaville": xcountry = "the_Republic_of_the_Congo" elif country.slug == "congo-kinshasa": xcountry = "the_Democratic_Republic_of_the_Congo" else: xcountry = country.country th.append((country.slug, country.country, xcountry)) sorted_result = sorted(result) t = mark_safe(simplejson.dumps(result)) tr = mark_safe(simplejson.dumps(th)) return render_to_response( "aid/countries.html", {"country_list": r, "res": t, "con": tr, "country_dict": country_dict} )
def country_list(request): r = Country.objects.all() country_dict=sorted_countries(r) return render_to_response('ukaid/countries.html',{'country_list':r,'country_dict':country_dict})
def country_list(request): from main.views import sorted_countries r = Country.objects.all() country_dict = sorted_countries(r) return render_to_response("globalfund/countries.html", {"country_list": r, "country_dict": country_dict})