Пример #1
0
def iso_flag(iso, flag_path=u''):
    """
    Returns a full path to the ISO 3166-1 alpha-2 country code flag image.
    
    Example usage::
        
        {{ user_profile.country.iso|iso_flag }}
        
        {{ user_profile.country.iso|iso_flag:"appmedia/flags/%s.png" }}
    
    """
    from countries.utils.isoflag import iso_flag
    return iso_flag(iso, flag_path)
Пример #2
0
def iso_flag(iso, flag_path=u''):
    """
	Returns a full path to the ISO 3166-1 alpha-2 country code flag image.
	
	Example usage::
		
		{{ user_profile.country.iso|iso_flag }}
		
		{{ user_profile.country.iso|iso_flag:"appmedia/flags/%s.png" }}
	
	"""
    from countries.utils.isoflag import iso_flag
    return iso_flag(iso, flag_path)
Пример #3
0
def country_flag(country):
	"""
	Returns a full path to the ISO 3166-1 alpha-2 country code flag image based on the country name
	"""
	if not country:
		return u''
	result = Country.objects.filter(name__icontains=country)
	if result:
		c = result[0]
		iso = c.iso
		flag_location = iso_flag(iso)
		return flag_location
	return u''
def iso_flag( iso, flag_path=u'' ):
  """
  Returns path to the ISO 3166-1 alpha-2 country code flag image.

  Arguments:
    iso -- the ISO-alpha-2 country code
    flag_path -- Given in the form '<path relative to media root>/%s.png'     
      and is appended to settings.MEDIA_URL.  If a valid flag_path is not
      given, tries to use settings.COUNTRIES_FLAG_PATH (default 'flags/%s.png')

  Usage:
    {{ user_profile.country.iso|iso_flag }}
    {{ user_profile.country.iso|iso_flag:"appmedia/flags/%s.png" }}
  
  """
  from countries.utils.isoflag import iso_flag
  return iso_flag( iso, flag_path )
Пример #5
0
def iso_flag(iso, flag_path=u''):
	from countries.utils.isoflag import iso_flag
	return iso_flag(iso, flag_path)
Пример #6
0
 def getFlag(self):
     if self.pais:
         return iso_flag(self.pais.iso or None)
     return ""