# Path: djangoplus/templatetags/djangoplus_tags.py
# @register.filter_function
# def moneyformat(value, decimal_places=2, thousands_separator=''):
#     """Returns a float value in monetary format, using MONETARY_LOCALE
#     setting and locale functions"""
#     decimal_places = decimal_places is None and 2 or decimal_places
#     thousands_separator = thousands_separator or app_settings.THOUSANDS_SEPARATOR
# 
#     import locale
# 
#     if app_settings.MONETARY_LOCALE:
#         locale.setlocale(locale.LC_NUMERIC, app_settings.MONETARY_LOCALE)
# 
#     format = r"%0.0"+str(decimal_places)+'f'
# 
#     value = value or 0.0
# 
#     ret = locale.format(format, float(value), grouping=True)
# 
#     if thousands_separator:
#         dec_sep = thousands_separator == ',' and '.' or ','
#         parts = ret.split(dec_sep)
#         ret = split1000(parts[0].replace(thousands_separator, ''), thousands_separator)
# 
#         if len(parts) > 1:
#             ret += dec_sep + parts[1]
# 
#     return ret
# 
# Path: djangoplus/app_settings.py
# MONETARY_LOCALE = getattr(settings, 'MONETARY_LOCALE', '')
# THOUSANDS_SEPARATOR = getattr(settings, 'THOUSANDS_SEPARATOR', '')
# STATIC_FILES_PATH = getattr(settings, 'STATIC_FILES_PATH', 'uploads')
# ROBOT_PROTECTION_DOMAIN = getattr(settings, 'ROBOT_PROTECTION_DOMAIN', None)
# RESULT_OK = getattr(settings, 'RESULT_OK', 'ok')
# RESULT_ERROR = getattr(settings, 'RESULT_ERROR', 'error')
# AJAX_FK_USE_MEDIA = getattr(settings, 'AJAX_FK_USE_MEDIA', True)


import types, re, decimal
from datetime import date, time, datetime
from django.utils.safestring import mark_safe
from django.db import models
from django.template.defaultfilters import yesno, linebreaksbr, urlize
from django.utils.text import capfirst
from django.utils import dateformat
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
    from django.utils.formats import get_format
        from django.utils.formats import localize
        from django.utils.translation import get_date_formats
from djangoplus.templatetags.djangoplus_tags import moneyformat
from djangoplus import app_settings
            if ordering and self._meta.ordering:
                return self.queryset.order_by(*self._meta.ordering)
            else:
                return self.queryset.all()
        except AttributeError:
            return self.queryset

    def summary(self):
        """Renders a summary with aggregation in the end of the grid.
        
        Uses the meta attributes:
            
         * show_summary
         * summary_fields
         * summary_td_template
         * summary_tr_template
        """
        fields = self._meta.fields or self.get_model_fields()

        qs = self.get_queryset()

        tsummary = []

        for f_name in fields:
            if f_name in self._meta.summary_fields:
                val = self._meta.summary_fields[f_name](qs)
            else:
                val = '&nbsp'
            
            if isinstance(val, decimal.Decimal):

# Path: djangoplus/templatetags/djangoplus_tags.py
# @register.filter_function
# def moneyformat(value, decimal_places=2, thousands_separator=''):
#     """Returns a float value in monetary format, using MONETARY_LOCALE
#     setting and locale functions"""
#     decimal_places = decimal_places is None and 2 or decimal_places
#     thousands_separator = thousands_separator or app_settings.THOUSANDS_SEPARATOR
# 
#     import locale
# 
#     if app_settings.MONETARY_LOCALE:
#         locale.setlocale(locale.LC_NUMERIC, app_settings.MONETARY_LOCALE)
# 
#     format = r"%0.0"+str(decimal_places)+'f'
# 
#     value = value or 0.0
# 
#     ret = locale.format(format, float(value), grouping=True)
# 
#     if thousands_separator:
#         dec_sep = thousands_separator == ',' and '.' or ','
#         parts = ret.split(dec_sep)
#         ret = split1000(parts[0].replace(thousands_separator, ''), thousands_separator)
# 
#         if len(parts) > 1:
#             ret += dec_sep + parts[1]
# 
#     return ret
# 
# Path: djangoplus/app_settings.py
# MONETARY_LOCALE = getattr(settings, 'MONETARY_LOCALE', '')
# THOUSANDS_SEPARATOR = getattr(settings, 'THOUSANDS_SEPARATOR', '')
# STATIC_FILES_PATH = getattr(settings, 'STATIC_FILES_PATH', 'uploads')
# ROBOT_PROTECTION_DOMAIN = getattr(settings, 'ROBOT_PROTECTION_DOMAIN', None)
# RESULT_OK = getattr(settings, 'RESULT_OK', 'ok')
# RESULT_ERROR = getattr(settings, 'RESULT_ERROR', 'error')
# AJAX_FK_USE_MEDIA = getattr(settings, 'AJAX_FK_USE_MEDIA', True)


# Path: djangoplus/model_info.py
import types, re, decimal
from datetime import date, time, datetime
from django.utils.safestring import mark_safe
from django.db import models
from django.template.defaultfilters import yesno, linebreaksbr, urlize
from django.utils.text import capfirst
from django.utils import dateformat
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
    from django.utils.formats import get_format
        from django.utils.formats import localize
        from django.utils.translation import get_date_formats
from djangoplus.templatetags.djangoplus_tags import moneyformat
from djangoplus import app_settings

            if ordering and self._meta.ordering:
                return self.queryset.order_by(*self._meta.ordering)
            else:
                return self.queryset.all()
        except AttributeError:
            return self.queryset

    def summary(self):
        """Renders a summary with aggregation in the end of the grid.
        
        Uses the meta attributes:
            
         * show_summary
         * summary_fields
         * summary_td_template
         * summary_tr_template
        """
        fields = self._meta.fields or self.get_model_fields()

        qs = self.get_queryset()

        tsummary = []

        for f_name in fields:
            if f_name in self._meta.summary_fields:
                val = self._meta.summary_fields[f_name](qs)
            else:
                val = '&nbsp'
            
            if isinstance(val, decimal.Decimal):

                val = moneyformat(val, None, app_settings.THOUSANDS_SEPARATOR)