Permalink
Browse files

country_name tag support internal call

  • Loading branch information...
1 parent 5923968 commit f088c94e4ae627c5899977c57f3fdcae5c1b91b2 @areski areski committed Nov 7, 2012
Showing with 12 additions and 2 deletions.
  1. +6 −0 CHANGES.txt
  2. +1 −1 country_dialcode/__init__.py
  3. +5 −1 country_dialcode/templatetags/country_dialcode_tags.py
View
6 CHANGES.txt
@@ -2,6 +2,12 @@ Changelog
=========
+0.4.7 (2012-11-07)
+------------------
+
+* country_name tag support internal call
+
+
0.4.6 (2012-11-07)
------------------
View
2 country_dialcode/__init__.py
@@ -9,7 +9,7 @@
# :license: MIT, see MIT-LICENSE.txt for more details.
-VERSION = (0, 4, 6, "")
+VERSION = (0, 4, 7, "")
__version__ = ".".join(map(str, VERSION[0:3])) + "".join(VERSION[3:])
__author__ = "Arezqui Belaid"
__contact__ = "areski@gmail.com"
View
6 country_dialcode/templatetags/country_dialcode_tags.py
@@ -2,6 +2,7 @@
from django.template.defaultfilters import stringfilter
from country_dialcode.models import Country
from country_dialcode.utils.isoflag import iso_flag as util_iso_flag
+from django.utils.translation import gettext as _
register = template.Library()
@@ -37,10 +38,13 @@ def country_name(country_id):
>>> country_name(198)
u'Spain'
"""
+ if country_id == '999':
+ #Added for internal call - ie flag/phone.png
+ return _('Internal Call')
try:
obj_country = Country.objects.get(id=country_id)
return obj_country.countryname
except:
- return u''
+ return u'unknown'
register.filter('country_name', country_name)

0 comments on commit f088c94

Please sign in to comment.