<commit_before>from django.conf import settings
from django.db import models

# Add MoneyField to 'south', so migrations are possible
try:
    if 'south' in getattr(settings, 'INSTALLED_APPS'):
        from south.modelsinspector import add_introspection_rules
        add_introspection_rules([], ["^djwepay\.fields\.MoneyField"])
except ImportError: pass

class MoneyField(models.DecimalField):
    def __init__(self, *args, **kwargs):
        if not 'decimal_places' in kwargs:
            kwargs['decimal_places'] = 2
        if not 'max_digits' in kwargs:
            kwargs['max_digits'] = 11 # ~1 billion USD, should be enough for now
        super(MoneyField, self).__init__(*args, **kwargs)
<commit_msg>made it compatible with Django 1.7<commit_after>from django.conf import settings
from django.db import models

# Add MoneyField to 'south', so migrations are possible
try:
    if 'south' in getattr(settings, 'INSTALLED_APPS'):
        from south.modelsinspector import add_introspection_rules
        add_introspection_rules([], ["^djwepay\.fields\.MoneyField"])
except ImportError: pass

class MoneyField(models.DecimalField):

    def __init__(self, *args, **kwargs):
        kwargs.setdefault('decimal_places', 2)
        kwargs.setdefault('max_digits', 11) # ~1 billion USD, should be enough for now
        super(MoneyField, self).__init__(*args, **kwargs)

    def deconstruct(self):
        try:
            name, path, args, kwargs = super(MoneyField, self).deconstruct()
            if self.decimal_places != 2:
                kwargs['decimal_places'] = self.decimal_places
            if self.max_digits != 11:
                kwargs['max_digits'] = self.max_digits
            return name, path, args, kwargs
        except AttributeError: pass
{'fraction_non_alphanumeric': 0.10475651189127973, 'fraction_numerical': 0.007361268403171008, 'mean_word_length': 3.3202933985330074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5151417', 'n_tokens_mistral': 542, 'n_tokens_neox': 507, 'n_words': 146}