And select the right one based on GeoIP location
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
<div class="form-group">
<select class="form-control" required>
<option value="">- {{ _("Country") }} -</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
+
+ {% for c in countries %}
+ <option value="{{ c.alpha2 }}" {% if country == c.alpha2 %}selected{% end %}>{{ c.name }}</option>
+ {% end %}
</select>
</div>
</div>
#!/usr/bin/python
#import httplib
+import iso3166
#import logging
#import markdown2
import operator
class DonateHandler(BaseHandler):
def get(self):
- self.render("donate.html")
+ location = self.get_remote_location()
+
+ if location:
+ country = location.country
+ else:
+ country = None
+
+ self.render("donate.html", countries=iso3166.countries, country=country)
@tornado.gen.coroutine
def post(self):