Skip to content

Commit

Permalink
country_name tag support internal call
Browse files Browse the repository at this point in the history
  • Loading branch information
areski committed Nov 7, 2012
1 parent 5923968 commit f088c94
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ Changelog
=========


0.4.7 (2012-11-07)
------------------

* country_name tag support internal call


0.4.6 (2012-11-07)
------------------

Expand Down
2 changes: 1 addition & 1 deletion country_dialcode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion country_dialcode/templatetags/country_dialcode_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down Expand Up @@ -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.