Example #1
0
def _get_format():
    locale = get_current_locale()
    if not locale:
        locale = Locale.parse(to_locale(settings.LANGUAGE_CODE))
    if timezone:
        tzinfo = timezone(settings.TIME_ZONE)
    else:
        tzinfo = None
    return Format(locale, tzinfo)
Example #2
0
def _get_format():
    locale = get_current_locale()
    if not locale:
        locale = Locale.parse(to_locale(settings.LANGUAGE_CODE))
    if timezone:
        tzinfo = timezone(settings.TIME_ZONE)
    else:
        tzinfo = None
    return Format(locale, tzinfo)
Example #3
0
 def render(self, name, value, attrs=None):
     u"""Render base widget and add bootstrap spans"""
     field = super(BootstrapCurrencyDecimalWidget, self).render(name, value, attrs)
     settingObj = None
     if self.user:
         settingObj = self.user.get_profile().currency
     currency = 'USD'
     if settingObj:
         currency = settingObj
     locale = get_current_locale()
     if not locale:
         Locale = babel.core.Locale
         locale = Locale.parse(to_locale(get_language()))
     return mark_safe((
         u'<div class="input-group">'
         u'    <span class="input-group-addon">%(data)s</span>%(field)s'
         u'</div>'
     ) % {'field': field, 'data': get_currency_symbol(currency, locale)})